diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2001-12-11 20:57:53 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2001-12-11 20:57:53 (GMT) |
commit | 0421075efcd50f01412f79d0f6ef4d22ea4daf58 (patch) | |
tree | 2083f8ca81ffa493eab31761459365545c6e165d /perform | |
parent | aec064a280cc591a952d4ce1b06613d28791f32f (diff) | |
download | hdf5-0421075efcd50f01412f79d0f6ef4d22ea4daf58.zip hdf5-0421075efcd50f01412f79d0f6ef4d22ea4daf58.tar.gz hdf5-0421075efcd50f01412f79d0f6ef4d22ea4daf58.tar.bz2 |
[svn-r4698]
Purpose:
Bug Fix
Description:
Fixed so that it will display the correct timing data. It will also
write to the correct file (which it wasn't before).
Solution:
Put the code in for displaying the time. Had to change the way I was
passing an object to the pio_fopen() function from just being a
structure to being a pointer so that the changes could be propagated
back.
Platforms tested:
Linux
Diffstat (limited to 'perform')
-rw-r--r-- | perform/pio_engine.c | 31 | ||||
-rw-r--r-- | perform/pio_perf.c | 23 |
2 files changed, 27 insertions, 27 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 57db58a..0d4d4ae 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -125,7 +125,7 @@ static char *pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size); static herr_t do_write(file_descr fd, iotype iot, long ndsets, long nelmts, hid_t h5dset_space_id, char *buffer); -static herr_t do_fopen(iotype iot, char *fname, file_descr fd /*out*/, +static herr_t do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags, MPI_Comm comm); static herr_t do_fclose(iotype iot, file_descr fd); @@ -260,7 +260,7 @@ do_pio(parameters param) pio_create_filename(iot, base_name, fname, sizeof(fname)); set_time(res.timers, HDF5_FILE_OPENCLOSE, START); - rc = do_fopen(iot, fname, fd, PIO_CREATE | PIO_WRITE, comm); + rc = do_fopen(iot, fname, &fd, PIO_CREATE | PIO_WRITE, comm); set_time(res.timers, HDF5_FILE_OPENCLOSE, STOP); VRFY((rc == SUCCESS), "do_fopen failed"); @@ -278,8 +278,9 @@ do_pio(parameters param) VRFY((rc == SUCCESS), "do_fclose failed"); +#if 0 /* Open file for read */ - hrc = do_fopen(iot, fname, fd, PIO_READ, comm); + hrc = do_fopen(iot, fname, &fd, PIO_READ, comm); VRFY((rc == SUCCESS), "do_fopen failed"); /* Calculate dataset offset within a file */ @@ -299,6 +300,7 @@ do_pio(parameters param) /* Close file for read */ rc = do_fclose(iot, fd); VRFY((rc == SUCCESS), "do_fclose failed"); +#endif /* 0 */ remove(fname); } @@ -327,9 +329,6 @@ done: } } - /* close any opened files */ - rc = do_fclose(iot, fd); - /* release generic resources */ free(buffer); res.ret_code = ret_code; @@ -559,8 +558,8 @@ done: * Modifications: */ static herr_t -do_fopen(iotype iot, char *fname, file_descr fd /*out*/, int flags, - MPI_Comm comm) +do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags, + MPI_Comm comm) { int ret_code = SUCCESS, mrc; herr_t hrc; @@ -569,12 +568,12 @@ do_fopen(iotype iot, char *fname, file_descr fd /*out*/, int flags, switch (iot) { case RAW: if ((flags | PIO_CREATE) || (flags | PIO_WRITE)) { - fd.rawfd = RAWCREATE(fname); + fd->rawfd = RAWCREATE(fname); } else { - fd.rawfd = RAWOPEN(fname, O_RDONLY); + fd->rawfd = RAWOPEN(fname, O_RDONLY); } - if (fd.rawfd < 0 ) { + if (fd->rawfd < 0 ) { fprintf(stderr, "Raw File Open failed(%s)\n", fname); GOTOERROR(FAIL); } @@ -584,10 +583,10 @@ do_fopen(iotype iot, char *fname, file_descr fd /*out*/, int flags, case MPIO: if ((flags | PIO_CREATE) || (flags | PIO_WRITE)) { mrc = MPI_File_open(comm, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fd.mpifd); + MPI_INFO_NULL, &fd->mpifd); } else { mrc = MPI_File_open(comm, fname, MPI_MODE_RDONLY, - MPI_INFO_NULL, &fd.mpifd); + MPI_INFO_NULL, &fd->mpifd); } if (mrc != MPI_SUCCESS) { @@ -614,14 +613,14 @@ do_fopen(iotype iot, char *fname, file_descr fd /*out*/, int flags, /* create the parallel file */ if ((flags | PIO_CREATE) || (flags | PIO_WRITE)) { - fd.h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + fd->h5fd = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); } else { - fd.h5fd = H5Fopen(fname, H5P_DEFAULT, acc_tpl); + fd->h5fd = H5Fopen(fname, H5P_DEFAULT, acc_tpl); } hrc = H5Pclose(acc_tpl); - if (fd.h5fd < 0) { + if (fd->h5fd < 0) { fprintf(stderr, "HDF5 File Create failed(%s)\n", fname); GOTOERROR(FAIL); } diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 0a546a4..4fda6a1 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -67,10 +67,14 @@ /* useful macros */ #define TAB_SPACE 4 -#define ONE_GB 1073741824UL +#define ONE_KB 1024 +#define ONE_MB (ONE_KB * ONE_KB) +#define ONE_GB (ONE_MB * ONE_KB) -#define MIN_HDF5_BUF_SIZE (1024 * 1024 * 8) -#define MAX_HDF5_BUF_SIZE (MIN_HDF5_BUF_SIZE * 4) +#define MB_PER_SEC(bytes,t) (((bytes) / ONE_MB) / t) + +#define MIN_HDF5_BUF_SIZE (ONE_MB >> 1) +#define MAX_HDF5_BUF_SIZE (ONE_GB / 2) /* local variables */ static const char *progname = "pio_perf"; @@ -241,13 +245,9 @@ run_test_loop(FILE *output, int max_num_procs, long max_size) print_indent(output, TAB_SPACE * 3); fprintf(output, "Write Results = %f MB/s\n", - /* WRONG */ - (parms.num_dsets * parms.num_elmts * sizeof(int)) / - get_time(res.timers, HDF5_WRITE_FIXED_DIMS)); + MB_PER_SEC(parms.num_dsets * parms.num_elmts * sizeof(int), + get_time(res.timers, HDF5_WRITE_FIXED_DIMS))); - /* get back ``result'' object and report */ - /* (res.ret_code == SUCCESS); */ - /* (res.timers); */ pio_time_destroy(res.timers); } } @@ -325,8 +325,9 @@ parse_command_line(int argc, char *argv[]) exit(EXIT_SUCCESS); case '?': default: - usage(progname); - exit(EXIT_FAILURE); + /* there could be other command line options, such as MPI stuff + * that gets passed to our program, for some reason */ + break; } } |