All global matrices must be distributed on the process grid prior to the invocation of a ScaLAPACK routine. It is the user's responsibility to perform this data distribution. For further information on the appropriate data distribution, please refer to Chapter 4.
Each global matrix that is to be distributed across the process grid must be assigned an array descriptor . Details of the entries in the array descriptor can be found in section 4.3.3. This array descriptor is most easily initialized with a call to a ScaLAPACK TOOLS routine called DESCINIT and must be set prior to the invocation of a ScaLAPACK routine.
As an example, the array descriptors for the matrices in figures 2.2 and 2.3 are assigned with the following code excerpt from the example program in section 2.3.
CALL DESCINIT( DESCA, M, N, MB, NB, RSRC, CSRC, ICTXT, MXLLDA, $ INFO ) CALL DESCINIT( DESCB, N, NRHS, NB, NBRHS, RSRC, CSRC, ICTXT, $ MXLLDB, INFO )These two calls to DESCINIT are equivalent to the assignment statements:
DESCA( 1 ) = 1 DESCA( 2 ) = ICTXT DESCA( 3 ) = M DESCA( 4 ) = N DESCA( 5 ) = MB DESCA( 6 ) = NB DESCA( 7 ) = RSRC DESCA( 8 ) = CSRC DESCA( 9 ) = MXLLDA * DESCB( 1 ) = 1 DESCB( 2 ) = ICTXT DESCB( 3 ) = N DESCB( 4 ) = NRHS DESCB( 5 ) = NB DESCB( 6 ) = NBRHS DESCB( 7 ) = RSRC DESCB( 8 ) = CSRC DESCB( 9 ) = MXLLDB
Details of the entries in the array descriptor can be found in section 4.3.3.
A simplistic mapping of the global matrix in figure 2.2 to a process grid is accomplished in the example program in section 2.3 via a call to the subroutine MATINIT. Please note that the routine MATINIT is not a ScaLAPACK routine and is used in this example program for demonstrative purposes only.
Appendix C.1 provides a more detailed example program, which reads a matrix from a file, distributes it onto a process grid, and then writes the solution to a file.