root / synthbench / euroben-dm / mod1h / .svn / text-base / stats_pe.f.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (2.3 kB)
1 |
Subroutine stats_pe( npes, ncases, tn, ops, |
---|---|
2 |
& Xi_t, tmin, tave, tmax, |
3 |
& Xi_r, rmin, rave, rmax ) |
4 |
! ---------------------------------------------------------------------- |
5 |
Use numerics |
6 |
Use max_params |
7 |
Implicit none |
8 |
Include 'mpif.h' |
9 |
|
10 |
Integer :: npes, ncases, type |
11 |
Real(l_) :: tn(ncases), ops |
12 |
Real(l_) :: Xi_t, tmn, tmin, tave, tmx, tmax |
13 |
Real(l_) :: Xi_r, rmn, rmin, rave, rmx, rmax |
14 |
Real(l_) :: tot_t, tot_t2, t_t, t_t2 |
15 |
Real(l_) :: tot_r, tot_r2, t_r, t_r2 |
16 |
Real(l_) :: rn |
17 |
Integer :: comm, ie, k, me |
18 |
! ---------------------------------------------------------------------- |
19 |
comm = MPI_Comm_World |
20 |
type = MPI_Real8 |
21 |
Call MPI_Comm_Rank( comm, me, ie ) |
22 |
|
23 |
tmin = tn(1) |
24 |
tmax = tn(1) |
25 |
rmin = ops/tn(1) |
26 |
rmax = ops/tn(1) |
27 |
tot_t = 0.0_l_ |
28 |
tot_t2 = 0.0_l_ |
29 |
tot_r = 0.0_l_ |
30 |
tot_r2 = 0.0_l_ |
31 |
Do k = 1, ncases |
32 |
tot_t = tot_t + tn(k) |
33 |
tot_t2 = tot_t2 + tn(k)*tn(k) |
34 |
tmn = Min( tmin, tn(k) ) |
35 |
tmx = Max( tmax, tn(k) ) |
36 |
|
37 |
rn = ops/tn(k) |
38 |
tot_r = tot_r + rn |
39 |
tot_r2 = tot_r2 + rn*rn |
40 |
rmn = Min( rmin, rn ) |
41 |
rmx = Max( rmax, rn ) |
42 |
End Do |
43 |
|
44 |
Call MPI_Barrier( comm, ie ) |
45 |
Call MPI_Allreduce( tot_t, t_t, 1, type, MPI_Sum, comm, ie ) |
46 |
Call MPI_Allreduce( tot_t2, t_t2, 1, type, MPI_Sum, comm, ie ) |
47 |
Call MPI_Allreduce( tot_r, t_r, 1, type, MPI_Sum, comm, ie ) |
48 |
Call MPI_Allreduce( tot_r2, t_r2, 1, type, MPI_Sum, comm, ie ) |
49 |
|
50 |
tave = t_t/(ncases*npes) |
51 |
rave = t_r/(ncases*npes) |
52 |
|
53 |
Call MPI_Barrier( comm, ie ) |
54 |
Call MPI_Allreduce( tmn, tmin, 1, type, MPI_Min, comm, ie ) |
55 |
Call MPI_Allreduce( tmx, tmax, 1, type, MPI_Max, comm, ie ) |
56 |
Call MPI_Allreduce( rmn, rmin, 1, type, MPI_Min, comm, ie ) |
57 |
Call MPI_Allreduce( rmx, rmax, 1, type, MPI_Max, comm, ie ) |
58 |
|
59 |
Xi_t = Sqrt( (t_t2-(ncases*npes)*tave**2)/ |
60 |
& Max( (ncases*npes), 1 ) ) |
61 |
Xi_r = Sqrt( (t_r2-(ncases*npes)*rave**2)/ |
62 |
& Max( (ncases*npes), 1 ) ) |
63 |
! ---------------------------------------------------------------------- |
64 |
End Subroutine stats_pe |