From 7697305e3bc1e5e317451d15a1a498706a372dbf Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 Jan 2020 16:18:21 -0600 Subject: Bring perform tools changes from develop --- tools/lib/io_timer.c | 85 +++++++++++++++++++----------------------- tools/lib/io_timer.h | 10 +++++ tools/perform/iopipe.c | 2 +- tools/perform/pio_engine.c | 36 +++++++++--------- tools/perform/pio_standalone.h | 4 +- tools/perform/sio_engine.c | 28 +++++++------- tools/perform/sio_standalone.h | 10 ++++- 7 files changed, 92 insertions(+), 83 deletions(-) diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index ed843d9..86e71de 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -138,43 +138,43 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) switch(pt->type){ #ifdef H5_HAVE_PARALLEL case MPI_CLOCK: - if (start_stop == TSTART) { - pt->mpi_timer[t] = MPI_Wtime(); - - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; - - } else { - pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t]; - pt->mpi_timer[t] = MPI_Wtime(); - - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; - } - break; + if (start_stop == TSTART) { + pt->mpi_timer[t] = MPI_Wtime(); + + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS]; + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS]; + + } else { + pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t]; + pt->mpi_timer[t] = MPI_Wtime(); + + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS]; + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS]; + } + break; #else case MPI_CLOCK: - HDfprintf(stderr, "MPI clock set in serial library\n"); - return NULL; + HDfprintf(stderr, "MPI clock set in serial library\n"); + return NULL; #endif /* H5_HAVE_PARALLEL */ case SYS_CLOCK: if (start_stop == TSTART) { HDgettimeofday(&pt->sys_timer[t], NULL); - /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS - * we compute the time it took to only open the file */ - if(t == HDF5_FINE_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); - else if(t == HDF5_FINE_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); + /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS + * we compute the time it took to only open the file */ + if(t == HDF5_FINE_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS])); + else if(t == HDF5_FINE_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS])); } else { @@ -183,19 +183,19 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) HDgettimeofday(&sys_t, NULL); pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t])); - /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS - * we compute the time it took to close the file after the last read/write finished */ - if(t == HDF5_GROSS_WRITE_FIXED_DIMS) - pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); - else if(t == HDF5_GROSS_READ_FIXED_DIMS) - pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); + /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS + * we compute the time it took to close the file after the last read/write finished */ + if(t == HDF5_GROSS_WRITE_FIXED_DIMS) + pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS])); + else if(t == HDF5_GROSS_READ_FIXED_DIMS) + pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS])); } - break; + break; default: - HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); - return NULL; + HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); + return NULL; } /* end switch */ #if 0 @@ -221,10 +221,3 @@ io_time_get(io_time_t *pt, timer_type t) return pt->total_time[t]; } - -#if 0 -/* standalone is not working yet. Need fix later. -AKC- */ -#ifdef STANDALONE -#include "pio_standalone.c" -#endif -#endif diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 78bf676..c1fa58e 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -28,6 +28,7 @@ #ifdef H5_HAVE_WINSOCK2_H # include #endif /* H5_HAVE_WINSOCK2_H */ + /* The different types of timers we can have */ typedef enum timer_type_ { HDF5_FILE_OPENCLOSE, @@ -70,10 +71,19 @@ typedef struct io_time_t { #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ + +#ifdef STANDALONE +io_time_t *io_time_new(clock_type t); +void io_time_destroy(io_time_t *pt); +io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); +double io_time_get(io_time_t *pt, timer_type t); +#else H5TOOLS_DLL io_time_t *io_time_new(clock_type t); H5TOOLS_DLL void io_time_destroy(io_time_t *pt); H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/tools/perform/iopipe.c b/tools/perform/iopipe.c index 2d9c44f..57c0d52 100644 --- a/tools/perform/iopipe.c +++ b/tools/perform/iopipe.c @@ -168,7 +168,7 @@ main (void) static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; unsigned char *the_data = NULL; - hid_t file, dset, file_space = -1; + hid_t file, dset, file_space = H5I_INVALID_HID; herr_t status; #ifdef H5_HAVE_GETRUSAGE struct rusage r_start, r_stop; diff --git a/tools/perform/pio_engine.c b/tools/perform/pio_engine.c index 5d8474b..d000f60 100644 --- a/tools/perform/pio_engine.c +++ b/tools/perform/pio_engine.c @@ -557,16 +557,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = -1; /*dataset space ID */ - hid_t h5mem_space_id = -1; /*memory dataspace ID */ - hid_t h5ds_id = -1; /*dataset handle */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ hsize_t h5block[2]; /*dataspace selection */ hsize_t h5stride[2]; hsize_t h5count[2]; hsize_t h5start[2]; hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dcpl = -1; /* Dataset creation property list */ - hid_t h5dxpl = -1; /* Dataset transfer property list */ + hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* Get the parameters from the parameter block */ blk_size=parms->blk_size; @@ -1402,7 +1402,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ } /* end for */ @@ -1458,7 +1458,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -1468,7 +1468,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -1478,7 +1478,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -1537,15 +1537,15 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* HDF5 variables */ herr_t hrc; /*HDF5 return code */ hsize_t h5dims[2]; /*dataset dim sizes */ - hid_t h5dset_space_id = -1; /*dataset space ID */ - hid_t h5mem_space_id = -1; /*memory dataspace ID */ - hid_t h5ds_id = -1; /*dataset handle */ + hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ + hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ + hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ hsize_t h5block[2]; /*dataspace selection */ hsize_t h5stride[2]; hsize_t h5count[2]; hsize_t h5start[2]; hssize_t h5offset[2]; /* Selection offset within dataspace */ - hid_t h5dxpl = -1; /* Dataset transfer property list */ + hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* Get the parameters from the parameter block */ blk_size=parms->blk_size; @@ -2357,7 +2357,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ } /* end for */ @@ -2413,7 +2413,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -2423,7 +2423,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -2433,7 +2433,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -2451,7 +2451,7 @@ done: do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) { int ret_code = SUCCESS, mrc; - hid_t acc_tpl = -1; /* file access templates */ + hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */ switch (param->io_type) { case POSIXIO: diff --git a/tools/perform/pio_standalone.h b/tools/perform/pio_standalone.h index fcb6666..8a25cef 100644 --- a/tools/perform/pio_standalone.h +++ b/tools/perform/pio_standalone.h @@ -492,8 +492,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #endif #ifdef H5_HAVE_PARALLEL -H5TEST_DLL int h5_set_info_object(void); -H5TEST_DLL void h5_dump_info_object(MPI_Info info); +int h5_set_info_object(void); +void h5_dump_info_object(MPI_Info info); #endif diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c index 9e93816..598e44a 100644 --- a/tools/perform/sio_engine.c +++ b/tools/perform/sio_engine.c @@ -114,11 +114,11 @@ static const char *multi_letters = "msbrglo"; /* string for multi driver */ /* HDF5 global variables */ static hsize_t h5count[MAX_DIMS]; /*selection count */ static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */ -static hid_t h5dset_space_id = -1; /*dataset space ID */ -static hid_t h5mem_space_id = -1; /*memory dataspace ID */ -static hid_t h5ds_id = -1; /*dataset handle */ -static hid_t h5dcpl = -1; /* Dataset creation property list */ -static hid_t h5dxpl = -1; /* Dataset transfer property list */ +static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */ +static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */ +static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */ +static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */ +static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */ /* * Function: do_sio @@ -577,7 +577,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ done: @@ -589,7 +589,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -599,7 +599,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -609,7 +609,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -896,7 +896,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } - h5ds_id = -1; + h5ds_id = H5I_INVALID_HID; } /* end if */ done: @@ -908,7 +908,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { - h5dset_space_id = -1; + h5dset_space_id = H5I_INVALID_HID; } } @@ -918,7 +918,7 @@ done: HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { - h5mem_space_id = -1; + h5mem_space_id = H5I_INVALID_HID; } } @@ -928,7 +928,7 @@ done: HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { - h5dxpl = -1; + h5dxpl = H5I_INVALID_HID; } } @@ -1130,7 +1130,7 @@ done: hid_t set_vfd(parameters *param) { - hid_t my_fapl = -1; + hid_t my_fapl = H5I_INVALID_HID; vfdtype vfd; vfd = param->vfd; diff --git a/tools/perform/sio_standalone.h b/tools/perform/sio_standalone.h index b3e4581..8750949 100644 --- a/tools/perform/sio_standalone.h +++ b/tools/perform/sio_standalone.h @@ -514,8 +514,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #endif #ifdef H5_HAVE_PARALLEL -H5TEST_DLL int h5_set_info_object(void); -H5TEST_DLL void h5_dump_info_object(MPI_Info info); +int h5_set_info_object(void); +void h5_dump_info_object(MPI_Info info); #endif @@ -543,4 +543,10 @@ typedef struct long_options { extern int get_option(int argc, const char **argv, const char *opt, const struct long_options *l_opt); + +extern int nCols; /*max number of columns for outputting */ + +/* Definitions of useful routines */ +extern void print_version(const char *progname); + #endif -- cgit v0.12