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