root / synthbench / euroben-dm / mod1h / reduction.f @ 0:839f52ef7657
History | View | Annotate | Download (1.3 kB)
1 |
Subroutine reduction( 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 :: k, kk, log2 |
16 |
Integer :: comm, ie, type |
17 |
External log2 |
18 |
Save a, b |
19 |
! ---------------------------------------------------------------------- |
20 |
comm = MPI_Comm_World |
21 |
type = MPI_Real8 |
22 |
title = ' N PEs --> N PEs; Reduction' |
23 |
nrpt = 100 |
24 |
ncases = npes |
25 |
ops = log2(npes)*2*8*n |
26 |
tn(1:maxcases) = 1.0e-15_l_ |
27 |
Do k = 1, ncases |
28 |
b = 0.0_l_ |
29 |
Call MPI_Barrier( comm, ie ) |
30 |
t1 = timer() |
31 |
Do kk = 1, nrpt |
32 |
Call MPI_Reduce( a, b, n, type, MPI_Sum, k-1, comm, ie ) |
33 |
End Do |
34 |
t2 = timer() |
35 |
tn(k) = Max( 1.0e-15_l_, (t2 - t1)/nrpt ) |
36 |
End Do |
37 |
! ---------------------------------------------------------------------- |
38 |
End Subroutine reduction |