root / synthbench / euroben-dm / mod1h / .svn / text-base / ping2.f.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (1.8 kB)
1 |
Subroutine ping2( 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 :: i, k, k2, kk |
16 |
Integer :: comm, ie, type |
17 |
Integer :: st(MPI_Status_Size) |
18 |
Save a, b |
19 |
! ---------------------------------------------------------------------- |
20 |
comm = MPI_Comm_World |
21 |
type = MPI_Real8 |
22 |
title = ' 1 PE <--> 1 PE; Bidir.' |
23 |
nrpt = 100 |
24 |
ncases = npes - 1 |
25 |
ops = 8*n |
26 |
i = 0 |
27 |
tn (1:maxcases) = 1.0e-15_l_ |
28 |
Do k = 0, npes-1 |
29 |
Do k2 = 0, npes-1 |
30 |
If ( k /= k2 ) Then |
31 |
Call MPI_Barrier( comm, ie ) |
32 |
If ( me == k ) Then |
33 |
Do kk = 1, nrpt |
34 |
Call MPI_Sendrecv( a, n, type, k2, kk*2, |
35 |
& b, n, type, k2, (kk*2) +1, comm, st, ie ) |
36 |
End Do |
37 |
End if |
38 |
If ( me == k2 ) Then |
39 |
i = i + 1 |
40 |
t1 = timer() |
41 |
Do kk = 1, nrpt |
42 |
Call MPI_Sendrecv( a, n, type, k, (kk*2)+1, |
43 |
& b, n, type, k, kk*2, comm, st, ie ) |
44 |
End Do |
45 |
t2 = timer() |
46 |
tn(i) = Max( 1.0e-15_l_, (t2 - t1)/(2*nrpt) ) |
47 |
End if |
48 |
End if |
49 |
End Do |
50 |
End Do |
51 |
! ---------------------------------------------------------------------- |
52 |
End Subroutine ping2 |