VIEWS: 117 PAGES: 9 CATEGORY: Emerging Technologies POSTED ON: 9/10/2010
Vol. 8 No. 5 August 2010 International Journal of Computer Science and Information Security Publication August 2010, Volume 8 No. 5 (Download Full Journal) (Archive)
(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 Feasibility Analysis of using Cannon Method to Perform Block Rhotrix Multiplication. Abdullahi M. 1, Ezugwu A. E. 2, Ahmed B. I. 3, Tukur S. M. 4 Department of Mathematics, Ahmadu Bello University, Zaria, Nigeria. 1 muham08@yahoo.com, 2 code_abs@yahoo.com, 3 barroonia@yahoo.co.uk, 4 smtexpert@yahoo.com result of the rhomboid nature of the arrangement of Abstract-This paper introduces the some mathematical arrays, which can simply concept of parallel rhotrix – rhotrix be seen as the combination of matrices. A rhotrix R multiplication, algorithm design and analysis is called a real rhotrix if all its entries belong to the set of Real Numbers. On the other hand a rhotrix R based on the idea of parallelization of is called an integer rhotrix if all its entries belong to matrix–matrix multiplication with Cannon the set of Integer Numbers. algorithm. Rhotrix is a matrix like array of n- dimensional form of rhomboid nature. The major difference Keywords: Rhotrix, rhotrix blocking, alignment between matrix and Rhotrix is the arrangement operation, shift operation, main entries, heart and the introduction of concept of a heart (h). entries. a 1. INTRODUCTION b h( R ) d Rhotrices multiplication was first introduced e and defined by Ajibade[1], and later Sani [2] gave an alternative row-column multiplication Fig 1: Rhotrix Representation of higher dimensional rhotrices. Their work was Rhotrix can be split into two forms of matrices: basically an idea that offers exercises for the main entries and the heart as shown in the mathematical enrichment with sets of objects figure below. which are in some ways between 2-dimensional vectors and 2x2-dimensional matrices as in [1], a d and for those objects which are in some ways b e h( R ) between nxn-dimensional matrices and (2n-1) x (2n-1) dimensional matrices as in [3]. where h(R) is the heart of the rhotrix. In this paper our interest is based on n- Fig 2: Rhotrix main entries and the heart dimensional rhotrix operation and its multiplication. The name rhotrix come up as a 231 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 2. HIGHER-DIMENSIONAL RHOTRICES We define the main rows and columns of rhotrix Rn depicted in figure 3 as: Ajibade[1] further added that, the dimension of rhotrices can be expanded in size but would at ,1 at 1,1 . . . a1,1 always be of odd dimension, he further proved at ,2 at 1,2 . . . a1,2 that an n-dimensional rhotrix Rn will have |Rn| at ,3 at 1,3 . . . a1,3 entries where |Rn| = (1/2)(n2+1). n-dimensional rhotrix can be represented as shown in figure 3. . . . . . . . . . . . . a11 at ,t at 1,t . . . a1,t a21 c11 a12 and a31 c21 a 22 c12 a31 . . . . . . . a1,1 . . . a1,t 1 a1,t Rn . . . . . . . . . a2,1 . . . a2,t 1 a2,t . . . . . . . a3,1 . . . a3,t 1 a3,t a tt-2 ct 1t 2 a t-1t-1 ct 2t 1 a t-2t . . . . . . a t-1t-2 c t-1t-1 a t-2t-1 . . . . . . a tt at ,1 . . . at ,t 1 at ,t Figure 3: General representation of n- Respectively, the rows and columns of Rn, i.e. those dimensional rhotrix (adopted from [3]) containing the values clk are similarly defined likewise. Where t=(n+1)/2, so that if n=3, then t=2. If n=5, t=3 and if n=7, t=4. In this case the 3rd, 5th 3. MULTIPLICATION OPERATION OF and 7th dimensional rhotrices are given in RHOTRICES figure4: Multiplication operation denoted by “o” can be a11 defined in many ways, but in this paper we R3 a21 c11 a12 restrict our idea based on B. Sani‟s [3] concept a22 of row-column multiplication of high dimensional rhotrices. Representing the n- a11 dimensional rhotrix in figure 3 above by Rn = a12 c11 a12 (aij,clk) where aij and clk represent the aij and clk R5 a31 c12 a22 c12 a13 elements respectively, with i,j=1,2,3,4,……,t a31 c22 a23 and l,k=1,2,3,4,…..t-1. a33 The general idea of multiplying any two a11 rhotrices of the same dimension still remain the a21 c11 a12 same with that which is obtainable in the matrix row-column multiplication method where the a31 c21 a22 c12 a13 set of elements aij multiply each other and R7 a41 c31 a32 c22 a23 c13 a14 elements clk also do likewise. Thus, the a42 c32 a33 c23 a24 multiplication of any two rhotrices say Rn and a43 c33 a34 Qn can defined as a44 Rn Qn = (ai1 j1,cl1k1 ) (bi 2 j 2, dl 2k 2 ) = t t 1 b) a ( , cd ) ( 2 i2 j1 1 j l k k i i2 2l l 2 1 j 2 2 12 k 11 232 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 Figure 6a: Blocking process of an eight dimensional rhotrix with main entries a and hearts d 233 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 Figure 6b: Blocking process of an eight dimensional rhotrix with main entries b and hearts e The blocking process from figure 6a and 6b above was obtained in similar manner as that of matrix blocking method performed using cannon algorithm. The eight dimensional rhotrix above was blocked into sixteen partitions comprising of rhotrix main entries and the heart elements denoted by a, b and d, e. Those elements outside the blocks are mapped to their corresponding elements with the same index number thereby allowing them to belong to the same partitioned block. 234 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 Two rhotrices R (A) and R (B) are considered to illustrate multiplication as shown below: Figure 7a: Example of blocking process of an eight dimensional rhotrix, R (A) Figure 7b: Example of blocking process of an eight dimensional rhotrix R (B) 235 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 1 2 2 5 2 3 7 2 Vol. 8, No. 5, August 2010 of Computer Science and Information Security, (IJCSIS) International Journal 3 1 3 3 1 3 1 2 Computation at Process P00, C00 and H00 2 3 2 2 6 1 7 5 1 7 1 4 6 1 3 2 After the first alignment A 3 2 1 7 3 7 5 3 1 2 1 2 3 12 C00 A00 B00 1 4 1 5 3 1 2 4 3 1 1 5 4 11 2 1 1 5 2 1 3 1 3 1 2 3 8 12 1 H 00 D00 E00 2 5 4 1 7 1 1 7 1 2 3 16 24 Figure 8a: Block of matrices of main entries of After the first shift rhotrix R (A) 3 12 2 5 3 1 C00 C00 A01 B10 3 1 1 4 1 2 1 4 11 3 3 2 2 7 1 1 4 2 5 4 3 12 16 12 19 24 5 2 1 4 7 1 1 4 11 15 9 19 20 D 1 3 4 1 1 2 2 8 12 1 4 4 3 H 00 H 00 D00 E00 7 5 1 5 1 1 3 16 24 1 4 4 1 3 5 7 7 1 2 3 8 12 20 7 28 19 1 2 2 3 3 3 3 16 24 20 7 36 31 Figure 8b: Block of matrices of heart entries of After the second shift rhotrix R (A) 1 2 1 2 2 1 3 1 19 24 2 3 3 1 C00 C00 A02 B20 1 5 1 3 1 2 4 3 19 20 1 3 3 2 3 1 1 2 6 2 4 2 19 24 15 8 34 32 2 2 4 4 1 1 5 6 19 20 12 7 31 27 B 3 1 3 1 5 3 3 1 3 2 1 1 2 1 1 1 28 19 1 2 1 3 H 00 H 00 D02 E20 36 31 2 5 1 1 1 2 1 3 1 5 1 1 2 1 4 4 4 1 1 5 28 19 3 5 31 24 36 31 7 11 43 42 Figure 8c: Block of matrices of main entries of rhotrix R (B) After the third shift 2 3 2 11 2 2 34 32 7 2 1 2 C00 C00 A03 B30 3 2 3 1 4 3 1 31 27 1 2 2 1 4 3 2 5 1 4 2 7 34 32 11 16 45 48 E 4 1 2 7 2 3 31 27 5 4 36 31 1 3 4 3 2 1 2 1 1 2 2 4 2 4 31 24 1 H 00 H 00 D03 E30 2 3 42 4 2 3 2 1 3 1 3 43 31 24 2 3 33 27 Figure 8d: Block of matrices of heart entries of 43 42 8 12 51 54 rhotrix R (B) 236 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 4. BLOCK RHOTRIX OPERATIONS (IJCSIS) International Journal of Computer Science and Information Security, 6. COMMUNICATION STEPS IN Vol. 8, No. 5, August 2010 CANNON'S ALGORITHM Rhotrix computations involving scalar algebraic operations on the rhotrix elements can be Applying the block row-column operation using expressed in terms of identical operations on the cannon‟s algorithm method for rhotrices submatrices of the original rhotrix. with main entries Ai,j , Bi,j and with corresponding hearts Di,j , Ei,j , we consider In this view, an n x n rhotrix A can be regarded cannon‟s matrix multiplication algorithm from as a q x q array of blocks Ai,j (0 ≤ i, j < q) such the point of view of process Pi,j. The processes that each block is an (n/q) x (n/q) subrhotrix. are organized into a 2-D mesh, and each process We perform q3 rhotrix multiplications, each has a block of A, B, D and E needed for involving (n/q) x (n/q) matrices requiring (n/q)3 computing C and H respectively. Figure 9a additions and multiplications. depicts the first block multiplication step. After each block multiplication process Pi,j sends its 5. RHOTRIX-RHOTRIX block of A to the process on its left and receives MULTIPLICATION: CANNON’S a new block of A from the process on its right. ALGORITHM PATTERN Similarly, it sends its block of B to the process above it and receives a new block of B from the Consider n dimensional rhotrices An and process below it. Figure 9b, 9c and 9d shows Bn partitioned into p blocks Ai,j and Bi,j the second, third and final block rhotrix (0 ≤ i, j < √p ) each. multiplication respectively. Summing the results Process Pi,j initially stores Ai,j ,Bi,j and of all block rhotrix multiplications yields Ci,j Di,j, Ei,j and computes block Ci,j and and Hi,j. Hi,j,of the resulting rhotrix. Blocking and Job Assignment Operation Computing subrhotrix Ci,j requires all A. First Alignment subrhotrices Ai,k, Bk,j and Di,k, Ek,j for 0 ≤ k <√p. Every process in the ith row requires all subrhotrices, the all-to-all broadcast can be avoided by scheduling the computations of the processes of the ith row such that, at any given time, each process is using a different block Ai,k and Di,k by systematically rotating these blocks among the processes after every submatrix multiplication so that every process gets a fresh Ai,k, and Di,k after each rotation. If an identical schedule is applied to the Figure 9a: First block rhotrix multiplication step. A, B columns of B and E, then no process and D, E after initial alignment holds more than one block of each matrix at any time. 237 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 B. Second Alignment (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 First, align the blocks of A, D and B, E in such a way that each process multiplies its local submatrices: Shift sub matrices Ai,j and Di,j to the left (with wraparound) by i steps. Shift sub matrices Bi,j and Ei,j up (with wraparound) by j steps. Perform local block matrix multiplication. Next, each block of A, D moves one step left and each block of B, E moves one step up (again with wraparound). Figure 9b: Final block rhotrix multiplication step. Sub-rhotrix location after first shift Perform next block multiplication; add to partial result, repeat until all the √p blocks have been C. Third Alignment multiplied. Figure 9c: Final block rhotrix multiplication step.Sub-rhotrix location after second shift Figure 10a row-column block rhotrix multiplication requiring all-gather operation D. Final Alignment Figure 9d: Final block rhotrix multiplication step 238 http://sites.google.com/site/ijcsis/ Figure 10b row-column block rhotrix multiplication ISSN 1947-5500 requiring all-gather communication (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 5, August 2010 7. BLOCK RHOTRIX ALGORITHM REFERENCES The block rhotrix multiplication algorithm for n x n matrices with a block size of (n/q) x (n/q) [1] Ajibade, A. O.,2003, the concept of rhotrix in mathematical enrichment, procedure RHOTRIX_MULT (A, B, C, D, E, International Journal of Mathematical H) Education in Science and Technology, 175-179. begin [2] B. Sani, 2006, the row-column for i := 0 to t - 1 do multiplication of high dimensional for j := 0 to t - 1 do rhotrices, International Journal of Mathematical Education in Science and begin Technology, 1-6. {Initialize all elements of Ci,j [3] B. Sani, 2006, Conversion of a and Hk,j to zero} rhotrix to a „coupled matrix‟ , C[i, j] := 0; International Journal of Mathematical Education in Science and Technology, H[i, j] := 0; 1-7. for k := 0 to t - 1 do {Receive message from slave Abdullahi Mohd received his B.Tech. process (worker) i,j} Degree from Federal University of Technology, Minna. Nigeria, in 2006. Ci,j := Ci,j + Ai,k x Bk,j; He is currently a staff in training Ahmadu Bllo University, Zaria. His Hi,j := Hi,j + Di,k x Ek,j; area of interest is High Performance Computing. endfor; endfor; Ezugwu E. A. received his BSc. Degree from Ahmadu Bello University, Zaria. {Write C and H to output file} Nigeria, in 2006. He is currently a master’s degree student in same end RHOTRIX_MULT University. His area of interest is Software Engineering. 8. CONCLUSION In this paper we discussed the basic concept of higher dimensional rhotrices multiplication and Barroon Isma’eel Ahmad received parallel algorithms for multiplying two n- the B.Sc Degree from Usmanu dimensional rhotrices R(A) and R(B) has been Danfodiyo University, Sokoto. proposed. The parallel rhotrix multiplication Nigeria, in 2006. He is currently a staff in training Ahmadu Bllo algorithms proposed is based on the University, Zaria. His interests are conventional serial algorithm. The idea of Mobile Communication and Location Aware Application matrix operations has been used in solving Development. product of n x n rhotrices. 239 http://sites.google.com/site/ijcsis/ ISSN 1947-5500