root / synthbench / euroben-dm / mod2h / mod2h.f @ 0:839f52ef7657
History | View | Annotate | Download (3.6 kB)
1 |
Program mod2h |
---|---|
2 |
! ********************************************************************** |
3 |
! *** This program is part of the EuroBen Benchmark *** |
4 |
! *** *** |
5 |
! *** Copyright: EuroBen Group p/o *** |
6 |
! *** Utrecht University, Computational Physics Dept. *** |
7 |
! *** P.O. Box 80.000 *** |
8 |
! *** 3508 TA Utrecht *** |
9 |
! *** The Netherlands *** |
10 |
! *** *** |
11 |
! *** Authors of this program: Aad van der Steen *** |
12 |
! *** Date Spring 2003 *** |
13 |
! *** Adjustments of timing resolution and problem set *** |
14 |
! *** by Aad van der Steen Fall 2003 *** |
15 |
! ********************************************************************** |
16 |
! Distributed Version 1.0 |
17 |
! |
18 |
! --- EuroBen Benchmark Module 2h. Computes uniformly distributed random |
19 |
! numbers in the interval [0,1). |
20 |
! ---------------------------------------------------------------------- |
21 |
Use numerics |
22 |
Use dist_module |
23 |
Use ran_module |
24 |
Implicit None |
25 |
|
26 |
Real(l_), Allocatable :: a(:) |
27 |
Real(l_) :: timebf, time |
28 |
Integer :: n, nsize, ops |
29 |
Integer :: mylength |
30 |
Integer :: er |
31 |
Real(l_) :: gtime, nops |
32 |
Real(l_) :: start_time, end_time |
33 |
Logical :: ok |
34 |
|
35 |
Include 'mpif.h' |
36 |
! ---------------------------------------------------------------------- |
37 |
! --- Call identification routine and start MPI. |
38 |
|
39 |
Call csetup |
40 |
start_time = MPI_Wtime() |
41 |
If ( me == 0 ) Call state( 'mod2h ' ) |
42 |
If ( me == 0 ) Print 1000, nodes |
43 |
! ---------------------------------------------------------------------- |
44 |
! --- Fill A with random numbers and include initialisation overhead |
45 |
! in the timing. |
46 |
|
47 |
Open( 1, File = 'mod2h.in' ) |
48 |
10 Read( 1, *, End = 20 ) nsize |
49 |
n = mylength( nsize ) |
50 |
Allocate( a(n) ) |
51 |
x1 = 2003 ! --- Seeds for random process. |
52 |
x2 = 2017 |
53 |
timebf = MPI_Wtime() |
54 |
Call rinit( n, a, nodes, me ) |
55 |
Call ranfil( a, n ) |
56 |
time = MPI_Wtime() - timebf |
57 |
ok = .TRUE. |
58 |
Call check( a, n, ok ) |
59 |
Call MPI_Reduce( time, gtime, 1, MPI_Real8, MPI_Max, 0, |
60 |
& MPI_Comm_World, er ) |
61 |
If ( me == 0 ) Then |
62 |
ops = 9*nsize |
63 |
nops = 1.0e-6_l_*ops/Max( gtime, 1.0e-15_l_ ) |
64 |
Print 1010, nsize, gtime, nops, ok |
65 |
End If |
66 |
Deallocate( a ) |
67 |
Go To 10 |
68 |
20 If ( me == 0 ) Print 1020 |
69 |
|
70 |
end_time = MPI_Wtime() - start_time |
71 |
If (me == 0) Then |
72 |
Write(6,22) 'Walltime: ', end_time, " s" |
73 |
22 Format(A,F9.3,A) |
74 |
End If |
75 |
|
76 |
Call MPI_Finalize( er ) |
77 |
! ---------------------------------------------------------------------- |
78 |
1000 Format(' Machine-independent random number generator dran2'/ |
79 |
& ' (including initialisation), nprocs = ', i3/ |
80 |
& '----------------------------------------'/ |
81 |
& ' Size | Time(s) | Mop/s |OK|'/ |
82 |
& '----------------------------------------' ) |
83 |
1010 Format( i8, '|', g13.5, '|', g13.5, '|', l2, '|' ) |
84 |
1020 Format('----------------------------------------' ) |
85 |
! ---------------------------------------------------------------------- |
86 |
End Program mod2h |