1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
INTEGER FUNCTION NUMROC( N, NB, IPROC, ISRCPROC, NPROCS )
*
* -- ScaLAPACK tools routine (version 1.7) --
* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
* and University of California, Berkeley.
* May 1, 1997
*
* .. Scalar Arguments ..
INTEGER IPROC, ISRCPROC, N, NB, NPROCS
* ..
*
* Purpose
* =======
*
* NUMROC computes the NUMber of Rows Or Columns of a distributed
* matrix owned by the process indicated by IPROC.
*
* Arguments
* =========
*
* N (global input) INTEGER
* The number of rows/columns in distributed matrix.
*
* NB (global input) INTEGER
* Block size, size of the blocks the distributed matrix is
* split into.
*
* IPROC (local input) INTEGER
* The coordinate of the process whose local array row or
* column is to be determined.
*
* ISRCPROC (global input) INTEGER
* The coordinate of the process that possesses the first
* row or column of the distributed matrix.
*
* NPROCS (global input) INTEGER
* The total number processes over which the matrix is
* distributed.
*
* =====================================================================
*
* .. Local Scalars ..
INTEGER EXTRABLKS, MYDIST, NBLOCKS
* ..
* .. Intrinsic Functions ..
INTRINSIC MOD
* ..
* .. Executable Statements ..
*
* Figure PROC's distance from source process
*
MYDIST = MOD( NPROCS+IPROC-ISRCPROC, NPROCS )
*
* Figure the total number of whole NB blocks N is split up into
*
NBLOCKS = N / NB
*
* Figure the minimum number of rows/cols a process can have
*
NUMROC = (NBLOCKS/NPROCS) * NB
*
* See if there are any extra blocks
*
EXTRABLKS = MOD( NBLOCKS, NPROCS )
*
* If I have an extra block
*
IF( MYDIST.LT.EXTRABLKS ) THEN
NUMROC = NUMROC + NB
*
* If I have last block, it may be a partial block
*
ELSE IF( MYDIST.EQ.EXTRABLKS ) THEN
NUMROC = NUMROC + MOD( N, NB )
END IF
*
RETURN
*
* End of NUMROC
*
END
|