diff --git a/benchmarks/FLASH-IO/README.md b/benchmarks/FLASH-IO/README.md index ecf558f48..836ea4e2c 100644 --- a/benchmarks/FLASH-IO/README.md +++ b/benchmarks/FLASH-IO/README.md @@ -49,8 +49,12 @@ and the I/O time of which dominates the entire benchmark. (this will use file base name prefix: "/pvfs2/flash_io_test_") + Command-line options: + * [-h] print this message * [-q] quiet mode - * [-i] use MPI independent I/O (default is collective I/O) + * [-b] use PnetCDF blocking APIs (default: nonblocking) + * [-i] use MPI independent I/O (default: collective) + * -f prefix: output file prefix name (required) + * Example output on screen: ```c diff --git a/benchmarks/FLASH-IO/flash_benchmark_io.F90 b/benchmarks/FLASH-IO/flash_benchmark_io.F90 index 5d33e0932..7910f2955 100644 --- a/benchmarks/FLASH-IO/flash_benchmark_io.F90 +++ b/benchmarks/FLASH-IO/flash_benchmark_io.F90 @@ -24,6 +24,7 @@ program flash_benchmark_io #endif integer i, argc, ierr character(len=128) executable + character(len=8) opt logical verbose, isArgvRight double precision time_io(3), time_begin @@ -42,48 +43,46 @@ program flash_benchmark_io MasterPE = 0 verbose = .TRUE. indep_io = .FALSE. + use_nonblocking_io = .TRUE. + basenm(1:1) = '' ! root process reads command-line arguments if (MyPE .EQ. MasterPE) then isArgvRight = .TRUE. argc = IARGC() ! IARGC() does not count the executable name call getarg(0, executable) - if (argc .EQ. 0) then - ! default file name prefix - basenm = "flash_io_test_" - else if (argc .EQ. 1) then - call getarg(1, basenm) - if (basenm(1:2) .EQ. '-q') then + do i=1, argc + call getarg(i, opt) + if (opt(1:2) .EQ. '-h') then + isArgvRight = .FALSE. + else if (opt(1:2) .EQ. '-q') then verbose = .FALSE. - basenm = "flash_io_test_" - else if (basenm(1:2) .EQ. '-i') then + else if (opt(1:2) .EQ. '-b') then + use_nonblocking_io = .FALSE. + else if (opt(1:2) .EQ. '-i') then indep_io = .TRUE. - basenm = "flash_io_test_" - endif - else if (argc .EQ. 2) then - call getarg(1, basenm) - if (basenm(1:2) .EQ. '-q') then - verbose = .FALSE. - call getarg(2, basenm) - else if (basenm(1:2) .EQ. '-i') then - indep_io = .TRUE. - call getarg(2, basenm) - else - isArgvRight = .FALSE. + else if (opt(1:2) .EQ. '-f') then + call getarg(i+1, basenm) + if (i .EQ. argc) then + isArgvRight = .FALSE. + else if (basenm(1:1) .EQ. '-') then + isArgvRight = .FALSE. + else if (LEN_TRIM(basenm(:)) .EQ. 0) then + isArgvRight = .FALSE. + endif endif - else if (argc .EQ. 3) then - call getarg(3, basenm) - if (basenm(1:2) .EQ. '-q' .OR. basenm(1:2) .EQ. '-i') then - isArgvRight = .FALSE. - endif - verbose = .FALSE. - indep_io = .TRUE. - else if (argc .GT. 2) then - isArgvRight = .FALSE. - endif + enddo + if (.NOT. isArgvRight) then + isArgvRight = .FALSE. + i = INDEX(executable, "/", .TRUE.) print *, & - 'Usage: ',trim(executable),' [-q] ' + 'Usage: ',trim(executable(i+1:)),' [-hqbi] -f ' + print *, ' -h: print this message' + print *, ' -q: quiet mode' + print *, ' -b: use PnetCDF blocking APIs (default: nonblocking)' + print *, ' -i: use MPI independent I/O (default: collective)' + print *, ' -f prefix: output file prefix name (required)' endif endif @@ -92,7 +91,11 @@ program flash_benchmark_io MPI_COMM_WORLD, ierr) if (.NOT. isArgvRight) goto 999 - ! broadcast if independent I/O should be used + ! broadcast whether nonblocking APIs should be used + call MPI_Bcast(use_nonblocking_io, 1, MPI_LOGICAL, MasterPE, & + MPI_COMM_WORLD, ierr) + + ! broadcast whether independent I/O should be used call MPI_Bcast(indep_io, 1, MPI_LOGICAL, MasterPE, & MPI_COMM_WORLD, ierr) @@ -119,9 +122,6 @@ program flash_benchmark_io neigh(:,:,:) = -1 empty(:) = 0 - ! use nonblocking APIs - use_nonblocking_io = .TRUE. - ! initialize the unknowns with the index of the variable do i = 1, nvar unk(i,:,:,:,:) = float(i) @@ -285,6 +285,19 @@ subroutine report_io_performance(verbose, local_blocks, time_io, & 1006 format(I5, 3x, i3,' x ',i3,' x ',i3, 3x, F7.2 , 2x,F10.2 /) 1007 format(A,A) + print 1004 + if (use_nonblocking_io) then + print *,' Using PnetCDF nonblocking APIs' + else + print *,' Using PnetCDF blocking APIs' + endif + if (indep_io) then + print *,' Using MPI independent I/O' + else + print *,' Using MPI collective I/O' + endif + print 1004 + print 1001,' number of guards : ',nguard print 1001,' number of guards : ',nguard print 1001,' number of blocks : ',local_blocks print 1001,' number of variables : ',nvar diff --git a/benchmarks/FLASH-IO/parallel_run.sh b/benchmarks/FLASH-IO/parallel_run.sh index 0e2ce2366..414caf1b8 100755 --- a/benchmarks/FLASH-IO/parallel_run.sh +++ b/benchmarks/FLASH-IO/parallel_run.sh @@ -35,7 +35,7 @@ for i in ${check_PROGRAMS} ; do export PNETCDF_SAFE_MODE=$j # echo "set PNETCDF_SAFE_MODE ${PNETCDF_SAFE_MODE}" - ${MPIRUN} ./$i -q ${TESTOUTDIR}/$i. + ${MPIRUN} ./$i -q -f ${TESTOUTDIR}/$i. if test $? = 0 ; then echo "PASS: F90 parallel run on $1 processes --------------- $i" @@ -55,7 +55,7 @@ for i in ${check_PROGRAMS} ; do # echo "test burst buffering feature" saved_PNETCDF_HINTS=${PNETCDF_HINTS} export PNETCDF_HINTS="${PNETCDF_HINTS};nc_burst_buf=enable;nc_burst_buf_dirname=${TESTOUTDIR};nc_burst_buf_overwrite=enable" - ${MPIRUN} ./$i -q ${TESTOUTDIR}/$i.bb. + ${MPIRUN} ./$i -q -f ${TESTOUTDIR}/$i.bb. if test $? = 0 ; then echo "PASS: F90 parallel run on $1 processes --------------- $i" fi