File: npreroc.f

package info (click to toggle)
scalapack 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 37,012 kB
  • sloc: fortran: 339,113; ansic: 74,517; makefile: 1,494; sh: 34
file content (85 lines) | stat: -rw-r--r-- 2,505 bytes parent folder | download | duplicates (12)
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
82
83
84
85
      INTEGER FUNCTION NPREROC( 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
*  =======
*
*  NPREROC computes the Number of PREceeding Rows Or Columns of a
*  distributed matrix that are possessed by processes closer to
*  ISRCPROC than IPROC.  Therefore, if ISRCPROC=0 and IPROC=4, then
*  NPREROC returns the number of distributed matrix rows or columns
*  owned by processes 0, 1, 2, and 3.
*
*  Arguments
*  =========
*
*  N         (global input) INTEGER
*            The number of rows or columns in the distributed matrix.
*
*  NB        (global input) INTEGER
*            Block size, size of the blocks the distributed matrix is
*            split into.
*
*  IPROC     (local intput) INTEGER
*            The coordinate of the process whose preceeding distributed
*            matrix rows or columns are 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 previous processes could have
*
      NPREROC = (NBLOCKS/NPROCS) * NB * MYDIST
*
*     See if there are any extra blocks
*
      EXTRABLKS = MOD( NBLOCKS, NPROCS )
*
*     If I have an extra block, all processes in front of me got one too
*
      IF( MYDIST.LE.EXTRABLKS ) THEN
         NPREROC = NPREROC + NB*MYDIST
*
*     If I have don't have an extra block, add in extra blocks of
*     preceeding processes and the partial block, if it exists
*
      ELSE
         NPREROC = NPREROC + EXTRABLKS*NB + MOD( N, NB )
      END IF
*
      RETURN
*
*     End of NPREROC
*
      END