@@ -24,6 +24,7 @@ program flash_benchmark_io
24
24
#endif
25
25
integer i, argc, ierr
26
26
character (len= 128 ) executable
27
+ character (len= 8 ) opt
27
28
logical verbose, isArgvRight
28
29
29
30
double precision time_io(3 ), time_begin
@@ -42,48 +43,46 @@ program flash_benchmark_io
42
43
MasterPE = 0
43
44
verbose = .TRUE.
44
45
indep_io = .FALSE.
46
+ use_nonblocking_io = .TRUE.
47
+ basenm(1 :1 ) = ' '
45
48
46
49
! root process reads command-line arguments
47
50
if (MyPE .EQ. MasterPE) then
48
51
isArgvRight = .TRUE.
49
52
argc = IARGC() ! IARGC() does not count the executable name
50
53
call getarg(0 , executable)
51
- if (argc .EQ. 0 ) then
52
- ! default file name prefix
53
- basenm = " flash_io_test_"
54
- else if (argc .EQ. 1 ) then
55
- call getarg(1 , basenm)
56
- if (basenm(1 :2 ) .EQ. ' -q' ) then
54
+ do i= 1 , argc
55
+ call getarg(i, opt)
56
+ if (opt(1 :2 ) .EQ. ' -h' ) then
57
+ isArgvRight = .FALSE.
58
+ else if (opt(1 :2 ) .EQ. ' -q' ) then
57
59
verbose = .FALSE.
58
- basenm = " flash_io_test_"
59
- else if (basenm(1 :2 ) .EQ. ' -i' ) then
60
+ else if (opt(1 :2 ) .EQ. ' -b' ) then
61
+ use_nonblocking_io = .FALSE.
62
+ else if (opt(1 :2 ) .EQ. ' -i' ) then
60
63
indep_io = .TRUE.
61
- basenm = " flash_io_test_"
62
- endif
63
- else if (argc .EQ. 2 ) then
64
- call getarg(1 , basenm)
65
- if (basenm(1 :2 ) .EQ. ' -q' ) then
66
- verbose = .FALSE.
67
- call getarg(2 , basenm)
68
- else if (basenm(1 :2 ) .EQ. ' -i' ) then
69
- indep_io = .TRUE.
70
- call getarg(2 , basenm)
71
- else
72
- isArgvRight = .FALSE.
64
+ else if (opt(1 :2 ) .EQ. ' -f' ) then
65
+ call getarg(i+1 , basenm)
66
+ if (i .EQ. argc) then
67
+ isArgvRight = .FALSE.
68
+ else if (basenm(1 :1 ) .EQ. ' -' ) then
69
+ isArgvRight = .FALSE.
70
+ else if (LEN_TRIM (basenm(:)) .EQ. 0 ) then
71
+ isArgvRight = .FALSE.
72
+ endif
73
73
endif
74
- else if (argc .EQ. 3 ) then
75
- call getarg(3 , basenm)
76
- if (basenm(1 :2 ) .EQ. ' -q' .OR. basenm(1 :2 ) .EQ. ' -i' ) then
77
- isArgvRight = .FALSE.
78
- endif
79
- verbose = .FALSE.
80
- indep_io = .TRUE.
81
- else if (argc .GT. 2 ) then
82
- isArgvRight = .FALSE.
83
- endif
74
+ enddo
75
+
84
76
if (.NOT. isArgvRight) then
77
+ isArgvRight = .FALSE.
78
+ i = INDEX (executable, " /" , .TRUE. )
85
79
print * , &
86
- ' Usage: ' ,trim (executable),' [-q] <ouput file base name>'
80
+ ' Usage: ' ,trim (executable(i+1 :)),' [-hqbi] -f <ouput file prefix name>'
81
+ print * , ' -h: print this message'
82
+ print * , ' -q: quiet mode'
83
+ print * , ' -b: use PnetCDF blocking APIs (default: nonblocking)'
84
+ print * , ' -i: use MPI independent I/O (default: collective)'
85
+ print * , ' -f prefix: output file prefix name (required)'
87
86
endif
88
87
endif
89
88
@@ -92,7 +91,11 @@ program flash_benchmark_io
92
91
MPI_COMM_WORLD, ierr)
93
92
if (.NOT. isArgvRight) goto 999
94
93
95
- ! broadcast if independent I/O should be used
94
+ ! broadcast whether nonblocking APIs should be used
95
+ call MPI_Bcast(use_nonblocking_io, 1 , MPI_LOGICAL, MasterPE, &
96
+ MPI_COMM_WORLD, ierr)
97
+
98
+ ! broadcast whether independent I/O should be used
96
99
call MPI_Bcast(indep_io, 1 , MPI_LOGICAL, MasterPE, &
97
100
MPI_COMM_WORLD, ierr)
98
101
@@ -119,9 +122,6 @@ program flash_benchmark_io
119
122
neigh(:,:,:) = - 1
120
123
empty(:) = 0
121
124
122
- ! use nonblocking APIs
123
- use_nonblocking_io = .TRUE.
124
-
125
125
! initialize the unknowns with the index of the variable
126
126
do i = 1 , nvar
127
127
unk(i,:,:,:,:) = float(i)
@@ -285,6 +285,19 @@ subroutine report_io_performance(verbose, local_blocks, time_io, &
285
285
1006 format (I5, 3x , i3,' x ' ,i3,' x ' ,i3, 3x , F7.2 , 2x ,F10.2 / )
286
286
1007 format (A,A)
287
287
288
+ print 1004
289
+ if (use_nonblocking_io) then
290
+ print * ,' Using PnetCDF nonblocking APIs'
291
+ else
292
+ print * ,' Using PnetCDF blocking APIs'
293
+ endif
294
+ if (indep_io) then
295
+ print * ,' Using MPI independent I/O'
296
+ else
297
+ print * ,' Using MPI collective I/O'
298
+ endif
299
+ print 1004
300
+ print 1001 ,' number of guards : ' ,nguard
288
301
print 1001 ,' number of guards : ' ,nguard
289
302
print 1001 ,' number of blocks : ' ,local_blocks
290
303
print 1001 ,' number of variables : ' ,nvar
0 commit comments