To initialize the library, the user should call make_multiplier. It
has the following signature:
int make_multiplier(CLA_Matrix_interface *A, CLA_Matrix_interface *B,
CLA_Matrix_interface *C, CProxy_ArrayElement bindA,
CProxy_ArrayElement bindB, CProxy_ArrayElement bindC,
int M, int K, int N, int m, int k, int n, int strideM, int strideK,
int strideZ, CkCallback cbA, CkCallback cbB, CkCallback cbC,
CkGroupID gid, int algorithm);
The CLA_Matrix_interface class (described in the following
section) is used to interact with the matrix multiplication library. The
arguments A, B, and C should point to different instances
of objects of this class.
The arguments bindA, bindB, and bindC should be proxies
to which the libraries A, B, and C arrays, respectively, will
be bound. There is no restriction as to whether these arrays must all be
different or the same.
The integers M, K, and N refer to the size of the
global data matrices. The A matrix is of size M x K. The B
matrix is of size K x N. The C matrix is of size M x N.
The arguments m, k, and n determine how many elements
of the global matrices each array element will hold. A ``typical'' chunk of
a matrix which has M as a dimension will have m elements. If
m does not divide M, the last element of the array along the given
dimension will have M mod m elements. The above is the same for the
K and k as well as N and n.
The striding arguments are used to specify the stride at which elements
along a given dimension should be created. For example, if bindA is a
dense matrix, strideM and strideK should both be . If bindC
has elements at
, strideN should be .
Note that although each of the dimensions is shared by two (potentially)
distinct arrays, there is no support for them to have different strides.
Since the library takes advantage of bound arrays to access memory
directly between the user and library objects, it is necessary to make sure
the library is properly initialized before it is used. As the A, B,
and C chare arrays finish initializing all their elements, they will
make callbacks to cbA, cbB, and cbC, respectively. These
can all be the same, but this is not checked, so there will be three calls made
to it.
The gid argument is a CkGroupID identifier which should be
used by the library to do its collective communications.
The algorithm argument specifies which algorithm the library should
use to carry out the multiplication. The valid options are MM_ALG_2D
for the ``2D'' algorithm, and MM_ALG_3D for the ``3D'' algorithm.
If the initialization success, zero is retuned. Otherwise, a negative number
is returned.