Download presentation
Presentation is loading. Please wait.
Published byDominick Walker Modified over 9 years ago
1
R EPRESENTING H IGHER D IMENSIONAL A RRAYS INTO A G ENERALIZED T WO - DIMENSIONAL A RRAY Authors K.M. Azharul Hasan Md Abu Hanif Shaikh Dept. of Computer Science and Engineering Khulna University of Engineering & Technology, Khulna, Bangladesh
2
P RESENTATION L AYOUT Motivation toward G2A Why G2APrevious Work G2A 3-D to 2-D4-D to 2-D6-D to 2-D Matrix Operation Algorithm Addition/SubtractionMultiplication Experimental Data Addition/SubtractionMultiplication
3
W HY 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)
4
P REVIOUS W ORK 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.
5
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)
6
G2A (C ONTINUED ….) Backward Mapping: Finding TMA from G2A Initialize x 1 ’ := 0, x 2 ’ : = 0 Repeat i := 1 to n Repeat j:= i +2 to n x i := x i × l j j := j + 2 x’ 2 - i%2 := x’ 2 - i%2 + x i
7
G2A: 3-D TO 2-D G2A A[ l 1 '][ l 2 '] for TMA(3) A[2][3][4] where l 1 '= l 1 × l 3 =8 and l 2 '= l 2 =3 Element A[1][1]2] of TMA(3) is equi- valent G2A is A[ x 1 '][ x 2 '] where x 1 '= 1 × 4 + 2 = 6 and x 2 '= x 2 =1 G2A is A[ x 1 '][ x 2 '] is known then it’s equivalent TMA(4) becomes A[ x 1 ][ x 2 ][ x 3 ] where x 3 = x 1 '% l 3 =6%4=2, x 1 = x 1 '/ l 3 =1 and x 2 = x 2 '=1
8
G2A: 4-D TO 2-D TMA(4) A[ l 1 ][ l 2 ][ l 3 ][ l 4 ] of size [2, 3, 3, 2], the corresponding G2A A[ l 1 '][ l 2 ‘] where l 1 '= l 1 × l 3 =2×3=6 and l 2 '= l 2 × l 4 =3×2=6 Element A[1][1][2][0] of TMA(4) is equivalent G2A is A[ x 1 '][ x 2 '] where x 1 '= 1 × 3 + 2 = 5 and x 2 '= 1 × 2 + 0 = 2 G2A is A[ x 1 '][ x 2 '] is known then it’s equivalent TMA(3) becomes A[ x 1 ][ x 2 ][ x 3 ] [ x 4 ] where x 3 = x 1 '% l 3 =5%3=2, x 1 = x 1 '/ l 3 =1 and x 4 = x 2 '% l 4 =2%2=0, x 2 = x 2 '/ l 4 =2/2=1
9
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 = x 1 × l 3 × l 5 + x 3 × l 5 + x 5, x ' 2 = x 2 × l 4 × l 6 + x 4 × l 6 + x 6 For backward mapping x 6 = 7 % l 6 = 7 % 2 = 1, x 4 =(7/ l 6 )% l 4 =(7/2)%3=0 x 2 =(7/ l 6 )/ l 4 =(7/2)/3=1 …………
10
M ATRIX -M ATRIX A DDITION /S UBTRACTION Algorithm 1: matrix- matrix_addition_TMA_n begin for x 1 = 0 to (l 1 -1) do for x 2 = 0 to (l 2 -1) do …………………. for x n =0 to (l n -1) do C[x 1 ][x 2 ]…[x n ] = A[x 1 ][x 2 ]…[x n ] + B[x 1 ][x 2 ]…[x n ]; End. Algorithm 2: matrix-matrix_addition_G2A begin for = 0 to (-1) do C'[ x ' 1 ][ x ' 2 ] = A'[ x ' 1 ][ x ' 2 ] + B'[ x ' 1 ][ x ' 2 ]; End.
11
M ATRIX -M ATRIX M ULTIPLICATION Algorithm 3: matrix- matrix_multiplication_TMA_n begin for x 1 = 0 to (l 1 -1) do for x 2 = 0 to (l 2 -1) do for x 3 =0 to (l 3 -1) do …………………… for x n-1 =0 to (l-1) do for x n =0 to (l-1) do for i =0 to (l-1) do C[x 1 ][x 2 ]…[x n-1 ][x n ]= C[x 1 ][x 2 ]…[x n-1 ][x n ] + A[x 1 ][x 2 ]…[x n-1 ][i]×B[x 1 ][x 2 ]…[i][ x n ]; End. Algorithm 4: matrix-matrix_multiplication_G2A begin for = 0 to (-1) do begin m= - for = 0 to (-1) do begin n = - 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.
12
M ATRIX O PERATION ( BLOCK BY BLOCK )
13
E XPERIMENTAL R ESULT (A DDITION ) 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.
14
E XPERIMENTAL R ESULT (M ULTIPLICATION ) 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.
15
F UTURE S COPE 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
16
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.