Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod1h / .svn / text-base / bisec2_reg.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (2.3 kB)

1
      Subroutine  bisec2_reg( title, me, npes, nrpt, ncases, n, tn,
2
     &                        ops )
3
! ----------------------------------------------------------------------
4
      Use            numerics
5
      Use            max_params      
6
      Implicit       None
7
      
8
      Include        'mpif.h'
9
      
10
      Character*50 :: title
11
      Integer      :: me, npes, nrpt, ncases, n
12
      Real(l_)     :: tn(maxcases), ops, timer
13
      Real(l_)     :: a(nmax), b(nmax)      
14
      Real(l_)     :: t1, t2
15
      Integer      :: source, target
16
      Integer      :: k, kk, nph
17
      Integer      :: comm, ie, rtag, stag, type
18
      Integer      :: status(MPI_Status_Size)
19
      Save            a, b
20
! ----------------------------------------------------------------------
21
      comm   = MPI_Comm_World
22
      type   = MPI_Real8
23
      title  = ' N/2 PEs<--  N/2 PEs; Bisect., Unidir., Regular'
24
      nrpt   = 50
25
      ops    = 8*n
26
      nph    = npes/2
27
      ncases = nph
28
      a      = 1.0_l_
29
      b      = 0.0_l_
30
      tn (1:maxcases) = 1.0e-15_l_
31

    
32
      Do k = 0, nph - 1
33
         If ( me < nph ) Then
34
            target = Mod( me + k, nph ) + nph
35
         Else
36
            source = Mod( me - k, nph )
37
         End If
38
         stag = 11111
39
  
40
         t1 = timer()
41
         Do kk = 0, nrpt-1
42
            stag = stag + kk
43
            rtag = stag + 1
44
            If ( me < nph ) Then
45
               Call MPI_Send(a, n, type, target, stag, comm, ie)
46
               Call MPI_Recv(b, n, type, target, rtag, comm, status, ie)
47
            Else
48
               Call MPI_Recv(b, n, type, source, stag, comm, status, ie)
49
               Call MPI_Send(a, n, type, source, rtag, comm, ie)
50
            End If
51
         End Do
52
         Do kk = 0, nrpt-1
53
            stag = stag + 1
54
            rtag = stag + 1
55
            If ( me < nph ) Then
56
               Call MPI_Recv(b, n, type, target, rtag, comm, status, ie)
57
               Call MPI_Send(a, n, type, target, stag, comm, ie)
58
            Else
59
               Call MPI_Send(a, n, type, source, rtag, comm, ie)
60
               Call MPI_Recv(b, n, type, source, stag, comm, status, ie)
61
            End If
62
         End Do
63
         t2     = timer()
64
         tn(k+1) = Max( 1.0e-15_l_, ( t2 - t1 )/( 4*nrpt ) )
65
      End Do
66
! ----------------------------------------------------------------------
67
      End