FNLMath : Utilities : ScaLAPACK_READ
ScaLAPACK_READ
For a detailed description of MPI Requirements see “Using ScaLAPACK Enhanced Routines” in the Introduction of this manual.
This routine reads matrix data from a file and transmits it into the two-dimensional block-cyclic form required by ScaLAPACK routines. This routine contains a call to a barrier routine so that if one process is writing the file and an alternate process is to read it, the results will be synchronized.
All processors in the BLACS context call the routine.
Required Arguments
File_Name A character variable naming the file containing the matrix data. (Input)
This file is opened with STATUS=“OLD. If the name is misspelled or the file does not exist, or any access violation occurs, a type = terminal error message will occur. After the contents are read, the file is closed. This file is read with a loop logically equivalent to groups of reads:
READ() ((BUFFER(I,J), I=1,M), J=1, NB)
or (optionally):
READ() ((BUFFER(I,J), J=1,N), I=1, MB)
DESC_A(*) The nine integer parameters associated with the ScaLAPACK matrix descriptor. Values for NB,MB,LDA are contained in this array. (Input)
A(LDA,*) This is an assumed-size array, with leading dimension LDA, that will contain this processor’s piece of the block-cyclic matrix. The data type for A(*,*) is any of five Fortran intrinsic types: integer; single precision, real; double precision, real; single precision, complex; and double precision, complex. (Output)
Optional Arguments
Format A character variable containing a format to be used for reading the file containing matrix data. If this argument is not present, an unformatted or list-directed read is used. (Input)
iopt Derived type array with the same precision as the array A(*,*), used for passing optional data to ScaLAPACK_READ. (Input)
The options are as follows:
Packaged Options for ScaLAPACK_READ
Option Prefix = ?
Option Name
Option Value
S_, d_
ScaLAPACK_READ_UNIT
1
S_, d_
ScaLAPACK_READ_FROM_PROCESS
2
S_, d_
ScaLAPACK_READ_BY_ROWS
3
iopt(IO) = ScaLAPACK_READ_UNIT
Sets the unit number to the value in iopt(IO + 1)%idummy. The default unit number is the value 11.
iopt(IO) = ScaLAPACK_READ_FROM_PROCESS
Sets the process number that reads the named file to the value in iopt(IO + 1)%idummy. The default process number is the value 0.
iopt(IO) = ScaLAPACK_READ_BY_ROWS
Read the matrix by rows from the named file. By default the matrix is read by columns.
FORTRAN 90 Interface
Generic: CALL ScaLAPACK_READ (File_Name, DESC_A, A [])
Specific: The specific interface names are S_ScaLAPACK_READ and D_ScaLAPACK_READ.
Description
Subroutine ScaLAPACK_READ reads columns or rows of a problem matrix so that it is usable by a ScaLAPACK routine. It uses the two-dimensional block-cyclic array descriptor for the matrix to place the data in the desired assumed-size arrays on the processors. The blocks of data are read, then transmitted and received. The block sizes, contained in the array descriptor, determines the data set size for each blocking send and receive pair. The number of these synchronization points is proportional to . A temporary local buffer is allocated for staging the matrix data. It is of size M by NB, when reading by columns, or N by MB, when reading by rows.
Example