From acac31a7f4d5c2b6d11fd317bef0ba37a98d9ed5 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 27 May 2002 23:04:18 -0500 Subject: [svn-r5463] Description: Folded the changes made in v1.4 into v1.5. print library version information in help page too. Specify the nofill feature supported in v1.5 only. Print the values of the KB, MB and GB in case a user wants to see them. Setup a macro, H5_HAVE_NOFILL, to indicate if Dataset no fill feature is supported. If not, --no-fill is an invalid option. Platforms tested: modi4 --- perform/pio_engine.c | 36 +++++++++++++++++++++--------------- perform/pio_perf.c | 17 ++++++++++++----- perform/pio_perf.h | 5 +++++ 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 54478a8..65d8d2d 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -445,7 +445,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, size_t buf_size, void *buffer) { int ret_code = SUCCESS; - long rc; /*routine return code */ + int rc; /*routine return code */ int mrc; /*MPI return code */ MPI_Offset mpi_offset; MPI_Status mpi_status; @@ -534,7 +534,7 @@ fprintf(stderr, "buffer size=%ld\n", buf_size); } /* end if */ } /* end if */ -#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 +#ifdef H5_HAVE_NOFILL /* Disable writing fill values if asked */ if(parms->h5_no_fill) { hrc = H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER); @@ -618,14 +618,17 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n", file_offset = dset_offset + (off_t)(elmts_begin + nelmts_written)*ELMT_SIZE; #if AKCDEBUG -fprintf(stderr, "proc %d: writes %ld bytes at file-offset %ld\n", - pio_mpi_rank_g, nelmts_towrite*ELMT_SIZE, file_offset); +HDfprintf(stderr, "proc %d: write %Hd bytes at file-offset %Hd\n", + pio_mpi_rank_g, (long_long)nelmts_towrite*ELMT_SIZE, (long_long)file_offset); #endif - rc = POSIXSEEK(fd->posixfd, file_offset); - VRFY((rc>=0), "POSIXSEEK"); - rc = POSIXWRITE(fd->posixfd, buffer, (size_t)(nelmts_towrite * ELMT_SIZE)); - VRFY((rc == (nelmts_towrite*ELMT_SIZE)), "POSIXWRITE"); + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc==0), "POSIXSEEK"); + /* check if all bytes are written */ + rc = ((nelmts_towrite*ELMT_SIZE) == + POSIXWRITE(fd->posixfd, buffer, nelmts_towrite*ELMT_SIZE)); + VRFY((rc != 0), "POSIXWRITE"); break; case MPIO: @@ -726,7 +729,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts, size_t buf_size, void *buffer /*out*/) { int ret_code = SUCCESS; - long rc; /*routine return code */ + int rc; /*routine return code */ int mrc; /*MPI return code */ MPI_Offset mpi_offset; MPI_Status mpi_status; @@ -849,14 +852,17 @@ fprintf(stderr, "proc %d: elmts_begin=%ld, elmts_count=%ld\n", file_offset = dset_offset + (off_t)(elmts_begin + nelmts_read)*ELMT_SIZE; #if AKCDEBUG -fprintf(stderr, "proc %d: read %ld bytes at file-offset %ld\n", - pio_mpi_rank_g, nelmts_toread*ELMT_SIZE, file_offset); +HDfprintf(stderr, "proc %d: read %Hd bytes at file-offset %Hd\n", + pio_mpi_rank_g, (long_long)nelmts_towrite*ELMT_SIZE, (long_long)file_offset); #endif - rc = POSIXSEEK(fd->posixfd, file_offset); - VRFY((rc>=0), "POSIXSEEK"); - rc = POSIXREAD(fd->posixfd, buffer, (size_t)(nelmts_toread*ELMT_SIZE)); - VRFY((rc==(nelmts_toread*ELMT_SIZE)), "POSIXREAD"); + /* only care if seek returns error */ + rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; + VRFY((rc==0), "POSIXSEEK"); + /* check if all bytes are read */ + rc = ((nelmts_toread*ELMT_SIZE) == + POSIXREAD(fd->posixfd, buffer, nelmts_toread*ELMT_SIZE)); + VRFY((rc != 0), "POSIXREAD"); break; case MPIO: diff --git a/perform/pio_perf.c b/perform/pio_perf.c index e44e2b8..72bfd06 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -1051,7 +1051,13 @@ parse_command_line(int argc, char *argv[]) cl_opts->num_iters = atoi(opt_arg); break; case 'n': /* Turn off writing fill values */ +#ifdef H5_HAVE_NOFILL cl_opts->h5_no_fill = 1; +#else + fprintf(stderr, "pio_perf: --no-fill not supported\n"); + usage(progname); + exit(1); +#endif break; case 'o': cl_opts->output_file = opt_arg; @@ -1147,7 +1153,7 @@ usage(const char *prog) MPI_Comm_rank(pio_comm_g, &myrank); if (myrank == 0) { - fflush(stdout); + print_version(prog); printf("usage: %s [OPTIONS]\n", prog); printf(" OPTIONS\n"); printf(" -h, --help Print a usage message and exit\n"); @@ -1164,6 +1170,7 @@ usage(const char *prog) printf(" -F N, --num-files=N Number of files [default: 1]\n"); printf(" -i, --num-iterations Number of iterations to perform [default: 1]\n"); printf(" -n, --no-fill Don't write fill values to HDF5 dataset\n"); + printf(" (Supported in HDF5 library v1.5 only)\n"); printf(" [default: off (i.e. write fill values)]\n"); printf(" -o F, --output=F Output raw data into file F [default: none]\n"); printf(" -P N, --max-num-processes=N Maximum number of processes to use\n"); @@ -1177,11 +1184,11 @@ usage(const char *prog) printf(" F - is a filename.\n"); printf(" N - is an integer >=0.\n"); printf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); - printf(" K - Kilobyte\n"); - printf(" M - Megabyte\n"); - printf(" G - Gigabyte\n"); + printf(" K - Kilobyte (%d)\n", ONE_KB); + printf(" M - Megabyte (%d)\n", ONE_MB); + printf(" G - Gigabyte (%d)\n", ONE_GB); printf("\n"); - printf(" Example: 37M = 37 Megabytes\n"); + printf(" Example: 37M = 37 Megabytes = %d bytes\n", 37*ONE_MB); printf("\n"); printf(" AL - is an API list. Valid values are:\n"); printf(" phdf5 - Parallel HDF5\n"); diff --git a/perform/pio_perf.h b/perform/pio_perf.h index 89aa879..efb100d 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -10,6 +10,11 @@ #include "pio_timer.h" #include "H5private.h" +/* setup the dataset no fill option if this is v1.5 or more */ +#if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 +#define H5_HAVE_NOFILL 1 +#endif + typedef enum iotype_ { POSIXIO, MPIO, -- cgit v0.12