Parallel Computing 6 (1988) 383-385 North-Holland
383
Short Communication
A two-layered mesh array for matrix multiplication Subhash C. KAK Deparmlem of Electrical and Computer Engineering, Louisiana State University, Baton Rouge, !.,4 70803, U.S.A. Received December 1986 Revised May 1987
Abstract. A two-layered mesh array for matrix multiplication is presented. It computes the matrix product faster than the standard array. Keywords. Mesh design, matrix multiplication, two-layered mesh array.
1. Introduction Consider the problem of matrix multiplication. The standard array [2] to compute the product of two 3 x 3 matrices is given in Fig. 1. It can be easily seen that the number of steps to solve this problem is ( 3 n - 2).
o
o
a13 a12 a l l
o
a23
a22 a21 o
a33
a32
a31 o
o
o
o
b33
o
b32
b23
b31 b21 b 11
b22
b13 o
:
bl2
-\
Fig. 1. The standard array to multiply matrices. The numbers inside the circles (processing elements) are the indices of the product matrix. 016%8191/88/$3.50 © 1988, Elsevier Science Publishers B.V. (North-Holland)
384
S.C. Kak / A two-layered mesh arrayfor matrix multiplication al 3 b31 a12 b21 all bll
a23 b32 a22 b22 a21 bl2
a33 b33 a32 b23 a31 b13
Fig. 2. The cylindricalarray for matrix multiplication.
b31 b21
al 3 a12
a23 a22
b32 b22
b33 b23
a33 a32
Fig. 3. Matrix multiplication on the mesh array. The double fines are connections on the top layer, and the single lines are connections on the bottom layer.
Porter and Aravena have introduced [3] the so-called cylindrical array (Fig. 2) that computes the matrix product in only ( 2 n - 1) steps. In this paper we present a mesh array, that has connections in two layers, that computes the matrix product as efficiently as the cylindrical array.
2. The 2-layered mesh array Figure 3 presents the new mesh array for the example of 3 x 3 matrices. The input-output table for this mesh array is given in Table 1. Note that the matrix product is computed in only 5 steps or (2n - 1) steps. The mesh array can be easily implemented. The processors can be defined in the same plane, and only the connections need to be laid out in two layers. The connections shown in double lines in Fig. 3 may be put in the top layer, requiting that the connections in single lines be in the bottom layer. Note that in the mesh array the order in which the b and the a values are inputted alternates, whereas in the cylindrical array it does not change. Furthermore, while the output cannot be obtained in the same sequence as the input data, which is true for the standard array, Table 1
Step
Input alla21a31 al2a22a32 a13a23a33
Output bllbl2bl3 b21b22b23 b31b32633
C11C22C33 C12C31C23 C32C13C21
S.C. Kak / A two-layered mesh arrayfor matrix multiplication
385
it need not be in the diagonal first form. The b columns and the a rows can be inputted in several other permutations. Certainly, the cylindrical array and our 2-layered mesh array are equivalent functionally. Yet the representation as a regular mesh defines a framework that offers advantages in implementation. Furthermore, each connection in the mesh design is shorter than the connections between the left and right borders of the cylindrical design.
3. Concluding remarks The 2-layered design presented in this note may be seen as the beginning of a multi-layered design [1]. The objective in a multi-layered design is to develop a three-dimensional array structure. Of course not all algorithms will lend themselves to efficient three-dimensional array implementation. The proposed mesh design may be used in VLSI or optical structures. The advantage of the new mesh array over the cylinderical architecture is the ease of implementation; note that the connecting lines in the mesh design are all of equal length while in the cylindrical design they are not. Further note that the equal length connections are a characteristic goal in VLSI design.
References [1] S.C. Kak, Multilayered array computing, Proc. 20th Annual Conference on Information Sciences and Systems, Princeton (1986) 436-441. [2] C. Mead and L. Conway, Introduction to VLSI Systems (Addison-Wesley, Read:rag, MA, 1980). [3] W.A. Porter and J.L. Aravena, Cylindrical arrays for matrix multiplication, Proc. 24th Annual Ailerton Conference on Communication, Control and Computing, Monticello, IL (1986).