diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-06-06 04:58:29 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-06-06 04:58:29 (GMT) |
commit | 7292287c89df97b6d8bbe062b95b4f469e7fa9ad (patch) | |
tree | cb48ab6cf44739409dd7b87ac3b8848f94bba168 /perform | |
parent | b803308acd00ef670afd1aae57ced7ac19244013 (diff) | |
download | hdf5-7292287c89df97b6d8bbe062b95b4f469e7fa9ad.zip hdf5-7292287c89df97b6d8bbe062b95b4f469e7fa9ad.tar.gz hdf5-7292287c89df97b6d8bbe062b95b4f469e7fa9ad.tar.bz2 |
[svn-r5539] Description:
Added the '-D v' option for "verify data correctness".
Platforms tested:
modi4, eirene, burrwhite (all pp).
Diffstat (limited to 'perform')
-rw-r--r-- | perform/pio_engine.c | 56 | ||||
-rw-r--r-- | perform/pio_perf.c | 8 | ||||
-rw-r--r-- | perform/pio_perf.h | 7 |
3 files changed, 47 insertions, 24 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 3b65f85..27251c3 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -34,7 +34,10 @@ /* Macro definitions */ /* sizes of various items. these sizes won't change during program execution */ +/* The following three must have the same type */ #define ELMT_SIZE (sizeof(int)) /* we're doing ints */ +#define ELMT_MPI_TYPE MPI_INT +#define ELMT_H5_TYPE H5T_NATIVE_INT #define GOTOERROR(errcode) { ret_code = errcode; goto done; } #define GOTODONE { goto done; } @@ -555,7 +558,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, #endif sprintf(dname, "Dataset_%ld", ndset); - h5ds_id = H5Dcreate(fd->h5fd, dname, H5T_NATIVE_INT, + h5ds_id = H5Dcreate(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, dcpl); if (h5ds_id < 0) { @@ -672,16 +675,14 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, nelmts_toxfer = elmts_count - nelmts_xfer; } -#ifdef AKCDEBUG - /*Prepare write data*/ - { + if (parms->verify) { + /*Prepare write data for verify later*/ int *intptr = (int *)buffer; register int i; for (i = 0; i < nelmts_toxfer; ++i) - *intptr++ = nelmts_toxfer + i; + *intptr++ = pio_mpi_rank_g; } -#endif /* Write */ /* Calculate offset of write within a dataset/file */ @@ -750,7 +751,7 @@ HDfprintf(output, case MPIO: mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*ELMT_SIZE; mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer, - (int)(nelmts_toxfer*ELMT_SIZE), MPI_CHAR, + (int)(nelmts_toxfer), ELMT_MPI_TYPE, &mpi_status); VRFY((mrc==MPI_SUCCESS), "MPIO_WRITE"); break; @@ -772,7 +773,7 @@ HDfprintf(output, } /* set write time here */ - hrc = H5Dwrite(h5ds_id, H5T_NATIVE_INT, h5mem_space_id, + hrc = H5Dwrite(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, H5P_DEFAULT, buffer); VRFY((hrc >= 0), "H5Dwrite"); break; @@ -1088,7 +1089,7 @@ HDfprintf(output, mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*ELMT_SIZE; mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer, - (int)(nelmts_toxfer*ELMT_SIZE), MPI_CHAR, + (int)(nelmts_toxfer), ELMT_MPI_TYPE, &mpi_status); VRFY((mrc==MPI_SUCCESS), "MPIO_read"); break; @@ -1111,24 +1112,37 @@ HDfprintf(output, } /* set read time here */ - hrc = H5Dread(h5ds_id, H5T_NATIVE_INT, h5mem_space_id, + hrc = H5Dread(h5ds_id, ELMT_H5_TYPE, h5mem_space_id, h5dset_space_id, H5P_DEFAULT, buffer); VRFY((hrc >= 0), "H5Dread"); break; - } + } /* switch (parms->io_type) */ -#ifdef AKCDEBUG - /*verify read data*/ - { + if (parms->verify) { + /*verify read data*/ int *intptr = (int *)buffer; register int i; - - for (i = 0; i < nelmts_toxfer; ++i) - /* TO BE IMPLEMENTED */ - #error "NOT IMPLEMENTED YET" - ; - } -#endif + register int nerror=0; + + for (i = 0; i < nelmts_toxfer; ++i){ + if (*intptr++ != pio_mpi_rank_g){ + if (++nerror < 20){ + /* report at most 20 errors */ + HDprint_rank(output); + HDfprintf(output, "read data error, expected (%Hd), " + "got (%Hd)\n", + (long_long)pio_mpi_rank_g, + (long_long)*(intptr-1)); + } + } + } + if (nerror >= 20) { + HDprint_rank(output); + HDfprintf(output, "..."); + HDfprintf(output, "total read data errors=%Hd\n", + nerror); + } + } /* if (parms->verify) */ nelmts_xfer += nelmts_toxfer; } diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 9427888..f27cec9 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -259,6 +259,7 @@ struct options { int h5_use_chunks; /* Make HDF5 dataset chunked */ int h5_no_fill; /* Disable HDF5 writing fill values */ int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ }; typedef struct _minmax { @@ -397,6 +398,7 @@ run_test_loop(struct options *opts) parms.h5_use_chunks = opts->h5_use_chunks; parms.h5_no_fill = opts->h5_no_fill; parms.h5_write_only = opts->h5_write_only; + parms.verify = opts->verify; /* start with max_num_procs and decrement it by half for each loop. */ /* if performance needs restart, fewer processes may be needed. */ @@ -1043,6 +1045,7 @@ parse_command_line(int argc, char *argv[]) cl_opts->h5_use_chunks = FALSE; /* Don't chunk the HDF5 dataset by default */ cl_opts->h5_no_fill = FALSE; /* Write fill values by default */ cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ + cl_opts->verify = FALSE; /* No Verify data correctness by default */ while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { @@ -1138,6 +1141,10 @@ parse_command_line(int argc, char *argv[]) /* Turn on time printing */ cl_opts->print_times = TRUE; break; + case 'v': + /* Turn on verify data correctness*/ + cl_opts->verify = TRUE; + break; default: fprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); exit(EXIT_FAILURE); @@ -1325,6 +1332,7 @@ usage(const char *prog) printf(" 4 - Everything and the kitchen sink\n"); printf(" r - Raw data I/O throughput information\n"); printf(" t - Times as well as throughputs\n"); + printf(" v - Verify data correctness\n"); printf("\n"); printf(" Example: --debug=2,r,t\n"); printf("\n"); diff --git a/perform/pio_perf.h b/perform/pio_perf.h index 83ab7d9..e812f16 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -34,9 +34,10 @@ typedef struct parameters_ { size_t block_size; /* interleaved block size */ hsize_t h5_align; /* HDF5 object alignment */ hsize_t h5_thresh; /* HDF5 object alignment threshold */ - unsigned h5_use_chunks; /* Make HDF5 dataset chunked */ - unsigned h5_no_fill; /* Disable HDF5 writing fill values */ - unsigned h5_write_only; /* Perform the write tests only */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_no_fill; /* Disable HDF5 writing fill values */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ } parameters; typedef struct results_ { |