Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2g / sizoff.f @ 0:839f52ef7657

History | View | Annotate | Download (1.4 kB)

1
      Subroutine sizoff( n1, n2, sizes, offset )
2
! ---------------------------------------------------------------------
3
! --- Routine 'sizoff' determines the sizes and offsets of a 2-D
4
!     array with dimensions 'n1' and 'n2' with respect to a 
5
!     distribution that is as even as possible on 'nodes' processors
6
!     ('nodes' being known from module 'dist_module').
7
!     Then the offsets for each local array with respect to the global
8
!     global array are determined.
9
! ---------------------------------------------------------------------
10
      Use     dist_module
11
      Integer n1, n2, sizes(0:nodes-1,2), offset(0:nodes-1,2)
12

    
13
      Integer i, k, non, nrest, rest
14
! ---------------------------------------------------------------------
15
      non   = n1/nodes
16
      rest  = Mod( n1, nodes )
17
      nrest = nodes - rest - 1
18
      Do i = 0, nodes - 1
19
         sizes(i,1) = non
20
         If ( i > nrest ) sizes(i,1) = non + 1
21
      End Do
22
      non   = n2/nodes
23
      rest  = Mod( n2, nodes )
24
      nrest = nodes - rest - 1
25
      Do i = 0, nodes - 1
26
         sizes(i,2) = non
27
         If ( i > nrest ) sizes(i,2) = non + 1
28
      End Do
29
      Do k = 1, 2
30
         offset(0,k) = 0
31
         Do i = 1, nodes - 1
32
            offset(i,k) = offset(i-1,k) + sizes(i-1,k)
33
         End Do
34
      End Do
35
! ----------------------------------------------------------------------
36
      End Subroutine sizoff