@@ -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
@@ -119,9 +118,6 @@ program flash_benchmark_io
119
118
neigh(:,:,:) = - 1
120
119
empty(:) = 0
121
120
122
- ! use nonblocking APIs
123
- use_nonblocking_io = .TRUE.
124
-
125
121
! initialize the unknowns with the index of the variable
126
122
do i = 1 , nvar
127
123
unk(i,:,:,:,:) = float(i)
@@ -285,6 +281,19 @@ subroutine report_io_performance(verbose, local_blocks, time_io, &
285
281
1006 format (I5, 3x , i3,' x ' ,i3,' x ' ,i3, 3x , F7.2 , 2x ,F10.2 / )
286
282
1007 format (A,A)
287
283
284
+ print 1004
285
+ if (use_nonblocking_io) then
286
+ print * ,' Using PnetCDF nonblocking APIs'
287
+ else
288
+ print * ,' Using PnetCDF blocking APIs'
289
+ endif
290
+ if (indep_io) then
291
+ print * ,' Using MPI independent I/O'
292
+ else
293
+ print * ,' Using MPI collective I/O'
294
+ endif
295
+ print 1004
296
+ print 1001 ,' number of guards : ' ,nguard
288
297
print 1001 ,' number of guards : ' ,nguard
289
298
print 1001 ,' number of blocks : ' ,local_blocks
290
299
print 1001 ,' number of variables : ' ,nvar
0 commit comments