Upload
dominick-walker
View
215
Download
0
Embed Size (px)
Citation preview
REPRESENTING HIGHER DIMENSIONAL ARRAYS INTO A GENERALIZED TWO-DIMENSIONAL ARRAY
Authors
K.M. Azharul Hasan
Md Abu Hanif Shaikh
Dept. of Computer Science and Engineering
Khulna University of Engineering & Technology,
Khulna, Bangladesh
PRESENTATION LAYOUTMotivation toward
G2A
Why G2A
Previous Work
WHY G2A ?
Modeling and analyzing scientific phenomena strongly requires handling large scale data of higher dimension efficiently and effectively
The cost of index computation becomes high for higher dimensional array
The cache miss rate increases for higher dimensional arrays as more cache lines need to be accessed
Visualization and operation on higher dimensional array is tough for Traditional Multidimensional Array (TMA)
PREVIOUS WORK
Extendible Karnaugh Map Representation (EKMR) by Lin et al. But it works well till four dimensions.
Matricization of n-way tensor by Brett W. Bader and Tamara G. Kolda has a higher storage rate though operation on stored data good hear.
G2A
N-dimensional array will be fitted in a 2-D space by placing odd dimensions in row direction and even dimensions along column direction
Forward Mapping: Equivalent G2A indices from TMA(n)
G2A (CONTINUED….)
Backward Mapping: Finding TMA from G2A
Initialize x1’ := 0, x2’ : = 0
Repeat i := 1 to n Repeat j:= i +2 to n xi := xi × lj j := j + 2 x’2 - i%2 := x’2 - i%2 + xi
G2A: 3-D TO 2-D
G2A A[l1'][ l2'] for
TMA(3) A[2][3][4] where l1'=l1×l3=8
and l2'=l2=3
Element A[1][1]2] of TMA(3) is equi-
valent G2A is A[x1'][ x2'] where x1'= 1 × 4 + 2 = 6 and x2'= x2 =1
G2A is A[x1'][ x2'] is known then it’s equivalent TMA(4) becomes A[x1][x2][x3] where x3=x1'%l3=6%4=2, x1=x1'/l3 =1 and x2 =x2'=1
G2A: 4-D TO 2-D
TMA(4) A[l1][l2][l3][l4] of size
[2, 3, 3, 2], the correspondingG2A A[l1'][ l2‘] where l1'=l1×l3=2×3=6 and l2'=l2×l4=3×2=6
Element A[1][1][2][0] of TMA(4) is equivalent G2A is A[x1'][ x2'] where x1'= 1 × 3 + 2 = 5 and x2'= 1 × 2 + 0 = 2
G2A is A[x1'][ x2'] is known then it’s equivalent TMA(3) becomes A[x1][x2][x3] [x4] where x3=x1'%l3=5%3=2, x1=x1'/l3 =1 and x4 =x2'%l4=2%2=0, x2 =x2'/l4=2/2=1
G2A: 6-D TO 2-D
Similarly for G2A of size[12,12] equivale-nt to TMA(6) of size [2, 2, 2, 3, 3, 2]x'1= x1×l3×l5+x3×l5+x5,
x'2=x2×l4×l6+x4× l6+ x6
For backward mappingx6 = 7 % l6 = 7 % 2 = 1,
x4=(7/l6)%l4=(7/2)%3=0
x2 =(7/l6)/l4=(7/2)/3=1
…………
MATRIX-MATRIX ADDITION/SUBTRACTIONAlgorithm 1:matrix-
matrix_addition_TMA_nbegin for x1 = 0 to (l1-1) do for x2 = 0 to (l2-1) do
………………….………………….
for xn =0 to (ln-1) do C[x1][x2]…[xn] = A[x1][x2]…[xn] + B[x1][x2]…[xn];End.
Algorithm 2:matrix-matrix_addition_G2A begin for = 0 to (-1) do for = 0 to (-1) do
C'[x'1][x'2] = A'[x'1][x'2] + B'[x'1][x'2]; End.
MATRIX-MATRIX MULTIPLICATIONAlgorithm 3:
matrix-matrix_multiplication_TMA_n
begin for x1 = 0 to (l1-1) do for x2 = 0 to (l2-1) do
for x3 =0 to (l3-1) do …………………… …………………… for xn-1 =0 to (l-1) do for xn =0 to (l-1) do
for i =0 to (l-1) doC[x1][x2]…[xn-1][xn]= C[x1][x2]…
[xn-1][xn] + A[x1][x2]…[xn-1][i]×B[x1][x2]…[i][ xn];
End.
Algorithm 4:matrix-matrix_multiplication_G2A
begin for = 0 to (-1) do
begin m= - for = 0 to (-1) do
beginn = -
for i =0 to (l-1) do C'[x'1][x'2] = C'[x'1][x'2] + A'[x'1][n+i] × B'[m+i][x‘2];
end End.
MATRIX OPERATION (BLOCK BY BLOCK)
EXPERIMENTAL RESULT (ADDITION)
0 20 40 60 80 100 120
0
500
1000
1500
2000
2500
Exe
cutio
n Tim
e (
ms)
Length of Dimensions
TMA(4) Addition G2A Addition
3 4 5 6 7 8 9 10 11 12
0
1000
2000
3000
4000
Length of Dimensions
Exe
cutio
n Tim
e (
ms)
TMA(8) Addition G2A Addition
Execution time is less for our proposed G2A scheme than TMA. Because the algorithm for TMA has many loops than G2A based algorithm. Hence TMA based algorithm has higher cache miss rate than that of G2A based algorithm.
EXPERIMENTAL RESULT (MULTIPLICATION)
Execution time is less for our proposed G2A scheme than TMA. Because the algorithm for TMA has many loops than G2A based algorithm. Hence TMA based algorithm has higher cache miss rate than that of G2A based algorithm.
0 20 40 60 80 100 120
0
50000
100000
150000
200000
250000
300000
TMA(4) Multiplication G2A Multiplication
Exe
cutio
n Ti
me
(m
s)
Length of Dimensions
3 4 5 6 7 8 9 10 11 12
0
10000
20000
30000
40000
50000
60000
TMA(8) Multiplication G2A Multiplication
Length of Dimensions
Exec
utio
n Ti
me
(m
s)
FUTURE SCOPE
Efficient Storage Scheme for higher dimensional sparse array
Better Memory Management with G2A than TMA
Operations on Stored data with G2A Parallelization on operation on G2A operation
Thank you