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 0:839f52ef7657 louridas
      Subroutine  bisec2_reg( title, me, npes, nrpt, ncases, n, tn,
2 0:839f52ef7657 louridas
     &                        ops )
3 0:839f52ef7657 louridas
! ----------------------------------------------------------------------
4 0:839f52ef7657 louridas
      Use            numerics
5 0:839f52ef7657 louridas
      Use            max_params
6 0:839f52ef7657 louridas
      Implicit       None
7 0:839f52ef7657 louridas
8 0:839f52ef7657 louridas
      Include        'mpif.h'
9 0:839f52ef7657 louridas
10 0:839f52ef7657 louridas
      Character*50 :: title
11 0:839f52ef7657 louridas
      Integer      :: me, npes, nrpt, ncases, n
12 0:839f52ef7657 louridas
      Real(l_)     :: tn(maxcases), ops, timer
13 0:839f52ef7657 louridas
      Real(l_)     :: a(nmax), b(nmax)
14 0:839f52ef7657 louridas
      Real(l_)     :: t1, t2
15 0:839f52ef7657 louridas
      Integer      :: source, target
16 0:839f52ef7657 louridas
      Integer      :: k, kk, nph
17 0:839f52ef7657 louridas
      Integer      :: comm, ie, rtag, stag, type
18 0:839f52ef7657 louridas
      Integer      :: status(MPI_Status_Size)
19 0:839f52ef7657 louridas
      Save            a, b
20 0:839f52ef7657 louridas
! ----------------------------------------------------------------------
21 0:839f52ef7657 louridas
      comm   = MPI_Comm_World
22 0:839f52ef7657 louridas
      type   = MPI_Real8
23 0:839f52ef7657 louridas
      title  = ' N/2 PEs<--  N/2 PEs; Bisect., Unidir., Regular'
24 0:839f52ef7657 louridas
      nrpt   = 50
25 0:839f52ef7657 louridas
      ops    = 8*n
26 0:839f52ef7657 louridas
      nph    = npes/2
27 0:839f52ef7657 louridas
      ncases = nph
28 0:839f52ef7657 louridas
      a      = 1.0_l_
29 0:839f52ef7657 louridas
      b      = 0.0_l_
30 0:839f52ef7657 louridas
      tn (1:maxcases) = 1.0e-15_l_
31 0:839f52ef7657 louridas
32 0:839f52ef7657 louridas
      Do k = 0, nph - 1
33 0:839f52ef7657 louridas
         If ( me < nph ) Then
34 0:839f52ef7657 louridas
            target = Mod( me + k, nph ) + nph
35 0:839f52ef7657 louridas
         Else
36 0:839f52ef7657 louridas
            source = Mod( me - k, nph )
37 0:839f52ef7657 louridas
         End If
38 0:839f52ef7657 louridas
         stag = 11111
39 0:839f52ef7657 louridas
40 0:839f52ef7657 louridas
         t1 = timer()
41 0:839f52ef7657 louridas
         Do kk = 0, nrpt-1
42 0:839f52ef7657 louridas
            stag = stag + kk
43 0:839f52ef7657 louridas
            rtag = stag + 1
44 0:839f52ef7657 louridas
            If ( me < nph ) Then
45 0:839f52ef7657 louridas
               Call MPI_Send(a, n, type, target, stag, comm, ie)
46 0:839f52ef7657 louridas
               Call MPI_Recv(b, n, type, target, rtag, comm, status, ie)
47 0:839f52ef7657 louridas
            Else
48 0:839f52ef7657 louridas
               Call MPI_Recv(b, n, type, source, stag, comm, status, ie)
49 0:839f52ef7657 louridas
               Call MPI_Send(a, n, type, source, rtag, comm, ie)
50 0:839f52ef7657 louridas
            End If
51 0:839f52ef7657 louridas
         End Do
52 0:839f52ef7657 louridas
         Do kk = 0, nrpt-1
53 0:839f52ef7657 louridas
            stag = stag + 1
54 0:839f52ef7657 louridas
            rtag = stag + 1
55 0:839f52ef7657 louridas
            If ( me < nph ) Then
56 0:839f52ef7657 louridas
               Call MPI_Recv(b, n, type, target, rtag, comm, status, ie)
57 0:839f52ef7657 louridas
               Call MPI_Send(a, n, type, target, stag, comm, ie)
58 0:839f52ef7657 louridas
            Else
59 0:839f52ef7657 louridas
               Call MPI_Send(a, n, type, source, rtag, comm, ie)
60 0:839f52ef7657 louridas
               Call MPI_Recv(b, n, type, source, stag, comm, status, ie)
61 0:839f52ef7657 louridas
            End If
62 0:839f52ef7657 louridas
         End Do
63 0:839f52ef7657 louridas
         t2     = timer()
64 0:839f52ef7657 louridas
         tn(k+1) = Max( 1.0e-15_l_, ( t2 - t1 )/( 4*nrpt ) )
65 0:839f52ef7657 louridas
      End Do
66 0:839f52ef7657 louridas
! ----------------------------------------------------------------------
67 0:839f52ef7657 louridas
      End