Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod1h / trans_2d.f @ 0:839f52ef7657

History | View | Annotate | Download (1.7 kB)

1
      Subroutine trans_2d( title, me, npes, nrpt, ncases, n, tn,
2
     &                    ops )
3
! ----------------------------------------------------------------------
4
      Use             numerics
5
      Use             max_params      
6
      Implicit        None     
7
      Include         'mpif.h'
8
      
9
      Character*50 :: title
10
      Integer      :: me, npes, nrpt, ncases, n
11
      Real(l_)     :: tn(maxcases), ops, timer 
12
      Real(l_)     :: a(nmax), b(nmax)      
13
      Real(l_)     :: t1, t2
14
      Integer      :: s_pe, r_pe
15
      Integer      :: k, kk, kb
16
      Integer      :: st(MPI_Status_Size)
17
      Integer      :: comm, ie, rtag, stag, type
18
      Save            a, b
19
! ---------------------------------------------------------------------- 
20
      comm   = MPI_Comm_World
21
      type   = MPI_Real8
22
      title  = ' N PEs  <--  N PEs; Trans 2D'
23
      nrpt   = 100
24
      ncases = npes
25
      ops    = npes*8*n
26
      tn(1:maxcases) = 1.0e-15_l_
27
      If ( n > nmax/npes ) Then
28
         ncases = 0
29
         Return
30
      End If
31
      Do k = 1,ncases      
32
        Call MPI_Barrier( comm, ie )      
33
        t1 = timer()
34
        Do kk = 1, nrpt 
35
           Do kb = 0, npes-1
36
              r_pe = Mod( me+kb, npes )
37
              s_pe = Mod( me-kb+npes, npes )
38
              stag = s_pe*nrpt + kk
39
              rtag = me*nrpt + kk
40
              Call MPI_Sendrecv( a(me*n), n, type, s_pe, stag, 
41
     &             b(r_pe*n), n, type, r_pe, rtag, comm, st, ie )
42
           End Do
43
        End Do
44
        t2    = timer()
45
        tn(k) = Max( 1.0e-15_l_, (t2 - t1)/(2*nrpt) )
46
      End Do
47
! ----------------------------------------------------------------------  
48
      End Subroutine trans_2d