diff options
Diffstat (limited to 'perform')
-rw-r--r-- | perform/CMakeLists.txt | 55 | ||||
-rw-r--r-- | perform/Makefile.in | 3 | ||||
-rw-r--r-- | perform/benchpar.c | 13 | ||||
-rw-r--r-- | perform/iopipe.c | 306 | ||||
-rw-r--r-- | perform/mpi-perf.c | 13 | ||||
-rw-r--r-- | perform/overhead.c | 309 | ||||
-rw-r--r-- | perform/perf.c | 113 | ||||
-rw-r--r-- | perform/pio_engine.c | 142 | ||||
-rw-r--r-- | perform/pio_perf.c | 11 | ||||
-rw-r--r-- | perform/pio_perf.h | 3 | ||||
-rw-r--r-- | perform/pio_standalone.h | 56 | ||||
-rw-r--r-- | perform/pio_timer.c | 72 | ||||
-rw-r--r-- | perform/pio_timer.h | 4 | ||||
-rw-r--r-- | perform/sio_engine.c | 28 | ||||
-rw-r--r-- | perform/sio_perf.c | 5 | ||||
-rw-r--r-- | perform/sio_perf.h | 29 | ||||
-rw-r--r-- | perform/sio_standalone.h | 48 | ||||
-rw-r--r-- | perform/sio_timer.c | 36 | ||||
-rw-r--r-- | perform/sio_timer.h | 6 | ||||
-rw-r--r-- | perform/zip_perf.c | 29 |
20 files changed, 679 insertions, 602 deletions
diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index 15db402..1bcf628 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.6) PROJECT (HDF5_PERFORM ) #----------------------------------------------------------------------------- @@ -19,6 +19,7 @@ SET (h5perf_serial_SRCS ADD_EXECUTABLE (h5perf_serial ${h5perf_serial_SRCS}) TARGET_NAMING (h5perf_serial ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (h5perf_serial PROPERTIES FOLDER perform) IF (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf_serial_alone @@ -33,6 +34,7 @@ IF (HDF5_BUILD_PERFORM_STANDALONE) ) TARGET_NAMING (h5perf_serial_alone ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + SET_TARGET_PROPERTIES (h5perf_serial_alone PROPERTIES FOLDER perform) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for chunk @@ -42,6 +44,7 @@ SET (chunk_SRCS ADD_EXECUTABLE(chunk ${chunk_SRCS}) TARGET_NAMING (chunk ${LIB_TYPE}) TARGET_LINK_LIBRARIES(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (chunk PROPERTIES FOLDER perform) #-- Adding test for iopipe SET (iopipe_SRCS @@ -50,6 +53,7 @@ SET (iopipe_SRCS ADD_EXECUTABLE (iopipe ${iopipe_SRCS}) TARGET_NAMING (iopipe ${LIB_TYPE}) TARGET_LINK_LIBRARIES (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (iopipe PROPERTIES FOLDER perform) #-- Adding test for overhead SET (overhead_SRCS @@ -58,6 +62,7 @@ SET (overhead_SRCS ADD_EXECUTABLE (overhead ${overhead_SRCS}) TARGET_NAMING (overhead ${LIB_TYPE}) TARGET_LINK_LIBRARIES (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +SET_TARGET_PROPERTIES (overhead PROPERTIES FOLDER perform) #-- Adding test for perf_meta SET (perf_meta_SRCS @@ -66,6 +71,7 @@ SET (perf_meta_SRCS ADD_EXECUTABLE (perf_meta ${perf_meta_SRCS}) TARGET_NAMING (perf_meta ${LIB_TYPE}) TARGET_LINK_LIBRARIES (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +SET_TARGET_PROPERTIES (perf_meta PROPERTIES FOLDER perform) #-- Adding test for zip_perf SET (zip_perf_SRCS @@ -74,6 +80,7 @@ SET (zip_perf_SRCS ADD_EXECUTABLE (zip_perf ${zip_perf_SRCS}) TARGET_NAMING (zip_perf ${LIB_TYPE}) TARGET_LINK_LIBRARIES (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +SET_TARGET_PROPERTIES (zip_perf PROPERTIES FOLDER perform) IF (H5_HAVE_PARALLEL) #-- Adding test for h5perf @@ -85,6 +92,7 @@ IF (H5_HAVE_PARALLEL) ADD_EXECUTABLE (h5perf ${h5perf_SRCS}) TARGET_NAMING (h5perf ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (h5perf PROPERTIES FOLDER perform) IF (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for h5perf @@ -99,6 +107,7 @@ IF (H5_HAVE_PARALLEL) ) TARGET_NAMING (h5perf_alone ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (h5perf_alone PROPERTIES FOLDER perform) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) #-- Adding test for benchpar @@ -108,14 +117,18 @@ IF (H5_HAVE_PARALLEL) ADD_EXECUTABLE (benchpar ${benchpar_SRCS}) TARGET_NAMING (benchpar ${LIB_TYPE}) TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (benchpar PROPERTIES FOLDER perform) #-- Adding test for mpi-perf - SET (mpi-perf_SRCS - ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c - ) - ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) - TARGET_NAMING (mpi-perf ${LIB_TYPE}) - TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + IF (NOT WIN32) + SET (mpi-perf_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c + ) + ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) + TARGET_NAMING (mpi-perf ${LIB_TYPE}) + TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + SET_TARGET_PROPERTIES (mpi-perf PROPERTIES FOLDER perform) + ENDIF (NOT WIN32) ENDIF (H5_HAVE_PARALLEL) @@ -138,7 +151,7 @@ ADD_CUSTOM_COMMAND ( # Remove any output file left over from previous test run ADD_TEST ( - NAME h5perform-clear-objects + NAME PERFORM_h5perform-clear-objects COMMAND ${CMAKE_COMMAND} -E remove chunk.h5 @@ -151,31 +164,33 @@ ADD_TEST ( x-gnuplot ) -ADD_TEST (NAME h5perf_serial COMMAND $<TARGET_FILE:h5perf_serial>) +ADD_TEST (NAME PERFORM_h5perf_serial COMMAND $<TARGET_FILE:h5perf_serial>) IF (HDF5_BUILD_PERFORM_STANDALONE) - ADD_TEST (NAME h5perf_serial_alone COMMAND $<TARGET_FILE:h5perf_serial_alone>) + ADD_TEST (NAME PERFORM_h5perf_serial_alone COMMAND $<TARGET_FILE:h5perf_serial_alone>) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) -ADD_TEST (NAME chunk COMMAND $<TARGET_FILE:chunk>) +ADD_TEST (NAME PERFORM_chunk COMMAND $<TARGET_FILE:chunk>) -ADD_TEST (NAME iopipe COMMAND $<TARGET_FILE:iopipe>) +ADD_TEST (NAME PERFORM_iopipe COMMAND $<TARGET_FILE:iopipe>) -ADD_TEST (NAME overhead COMMAND $<TARGET_FILE:overhead>) +ADD_TEST (NAME PERFORM_overhead COMMAND $<TARGET_FILE:overhead>) -ADD_TEST (NAME perf_meta COMMAND $<TARGET_FILE:perf_meta>) +ADD_TEST (NAME PERFORM_perf_meta COMMAND $<TARGET_FILE:perf_meta>) -ADD_TEST (NAME zip_perf_help COMMAND $<TARGET_FILE:zip_perf> "-h") -ADD_TEST (NAME zip_perf COMMAND $<TARGET_FILE:zip_perf> tfilters.h5) +ADD_TEST (NAME PERFORM_zip_perf_help COMMAND $<TARGET_FILE:zip_perf> "-h") +ADD_TEST (NAME PERFORM_zip_perf COMMAND $<TARGET_FILE:zip_perf> tfilters.h5) IF (H5_HAVE_PARALLEL) - ADD_TEST (NAME h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>) + ADD_TEST (NAME PERFORM_h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>) IF (HDF5_BUILD_PERFORM_STANDALONE) - ADD_TEST (NAME h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>) + ADD_TEST (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf_alone>) ENDIF (HDF5_BUILD_PERFORM_STANDALONE) - ADD_TEST (NAME benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) +# ADD_TEST (NAME PERFORM_benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) - ADD_TEST (NAME mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) + IF (NOT WIN32) + ADD_TEST (NAME PERFORM_mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) + ENDIF (NOT WIN32) ENDIF (H5_HAVE_PARALLEL) diff --git a/perform/Makefile.in b/perform/Makefile.in index d0264e7..39739a4 100644 --- a/perform/Makefile.in +++ b/perform/Makefile.in @@ -224,6 +224,7 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ +FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ @@ -244,10 +245,12 @@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ +HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ diff --git a/perform/benchpar.c b/perform/benchpar.c index 035e9d6..24146e4 100644 --- a/perform/benchpar.c +++ b/perform/benchpar.c @@ -13,7 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifdef H5_HAVE_UNISTD_H #include <unistd.h> +#endif #include <stdlib.h> #include <assert.h> #include <math.h> @@ -23,6 +25,11 @@ #include "hdf5.h" /* Local macros */ +#ifdef H5_HAVE_VISUAL_STUDIO +#define HDgetlogin() Wgetlogin() +#else /* H5_HAVE_VISUAL_STUDIO */ +#define HDgetlogin() getlogin() +#endif /* H5_HAVE_VISUAL_STUDIO */ /* * HDF Boolean type. @@ -115,13 +122,13 @@ static hid_t create_fapl(MPI_Comm comm, MPI_Info info, int acc_type ) /* set parallel access with communicator, using MPI-I/O driver */ if (acc_type == FACC_MPIO) { - ret = H5Pset_fapl_mpio(fapl, comm, info); + ret = H5Pset_fapl_mpio(fapl, comm, info); assert(ret>=0); } /* end if */ /* set parallel access with communicator, using MPI-posix driver */ if (acc_type == FACC_MPIPOSIX) { - ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs); + ret = H5Pset_fapl_mpiposix(fapl, comm, use_gpfs); assert(ret>=0); } /* end if */ @@ -312,7 +319,7 @@ int main(int argc, char *argv[]) char *login; /* Pointer to login name */ /* Get the login name for this user */ - login=getlogin(); + login=HDgetlogin(); if(login==NULL) login=DEFAULT_USERNAME; diff --git a/perform/iopipe.c b/perform/iopipe.c index c72e3aa..85063fa 100644 --- a/perform/iopipe.c +++ b/perform/iopipe.c @@ -28,34 +28,34 @@ #endif -#define RAW_FILE_NAME "iopipe.raw" -#define HDF5_FILE_NAME "iopipe.h5" -#define HEADING "%-16s" -#define PROGRESS '=' +#define RAW_FILE_NAME "iopipe.raw" +#define HDF5_FILE_NAME "iopipe.h5" +#define HEADING "%-16s" +#define PROGRESS '=' #if 0 /* Normal testing */ -#define REQUEST_SIZE_X 4579 -#define REQUEST_SIZE_Y 4579 -#define NREAD_REQUESTS 45 -#define NWRITE_REQUESTS 45 +#define REQUEST_SIZE_X 4579 +#define REQUEST_SIZE_Y 4579 +#define NREAD_REQUESTS 45 +#define NWRITE_REQUESTS 45 #else /* Speedy testing */ -#define REQUEST_SIZE_X 1000 -#define REQUEST_SIZE_Y 1000 -#define NREAD_REQUESTS 45 -#define NWRITE_REQUESTS 45 +#define REQUEST_SIZE_X 1000 +#define REQUEST_SIZE_Y 1000 +#define NREAD_REQUESTS 45 +#define NWRITE_REQUESTS 45 #endif /*------------------------------------------------------------------------- - * Function: print_stats + * Function: print_stats * - * Purpose: Prints statistics + * Purpose: Prints statistics * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -65,63 +65,63 @@ #ifdef H5_HAVE_GETRUSAGE static void print_stats (const char *prefix, - struct rusage *r_start, struct rusage *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) + struct rusage *r_start, struct rusage *r_stop, + struct timeval *t_start, struct timeval *t_stop, + size_t nbytes) #else /* H5_HAVE_GETRUSAGE */ static void print_stats (const char *prefix, - struct timeval *r_start, struct timeval *r_stop, - struct timeval *t_start, struct timeval *t_stop, - size_t nbytes) + struct timeval *r_start, struct timeval *r_stop, + struct timeval *t_start, struct timeval *t_stop, + size_t nbytes) #endif /* H5_HAVE_GETRUSAGE */ { - double e_time, bw; + double e_time, bw; #ifdef H5_HAVE_GETRUSAGE - double u_time, s_time; + double u_time, s_time; u_time = ((double)(r_stop->ru_utime.tv_sec)+ - (double)(r_stop->ru_utime.tv_usec)/1000000.0) - - ((double)(r_start->ru_utime.tv_sec)+ - (double)(r_start->ru_utime.tv_usec)/1000000.0); + (double)(r_stop->ru_utime.tv_usec)/1000000.0) - + ((double)(r_start->ru_utime.tv_sec)+ + (double)(r_start->ru_utime.tv_usec)/1000000.0); s_time = ((double)(r_stop->ru_stime.tv_sec)+ - (double)(r_stop->ru_stime.tv_usec)/1000000.0) - - ((double)(r_start->ru_stime.tv_sec)+ - (double)(r_start->ru_stime.tv_usec)/1000000.0); + (double)(r_stop->ru_stime.tv_usec)/1000000.0) - + ((double)(r_start->ru_stime.tv_sec)+ + (double)(r_start->ru_stime.tv_usec)/1000000.0); #endif #ifndef H5_HAVE_SYS_TIMEB e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000000.0) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000000.0); + (double)(t_stop->tv_usec)/1000000.0) - + ((double)(t_start->tv_sec)+ + (double)(t_start->tv_usec)/1000000.0); #else e_time = ((double)(t_stop->tv_sec)+ - (double)(t_stop->tv_usec)/1000.0) - - ((double)(t_start->tv_sec)+ - (double)(t_start->tv_usec)/1000.0); + (double)(t_stop->tv_usec)/1000.0) - + ((double)(t_start->tv_sec)+ + (double)(t_start->tv_usec)/1000.0); #endif bw = (double)nbytes / e_time; #ifdef H5_HAVE_GETRUSAGE printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n", - prefix, u_time, s_time, e_time, bw/(1024*1024)); + prefix, u_time, s_time, e_time, bw/(1024*1024)); #else printf (HEADING "%1.2felapsed %1.2fMB/s\n", - prefix, e_time, bw/(1024*1024)); + prefix, e_time, bw/(1024*1024)); #endif } /*------------------------------------------------------------------------- - * Function: synchronize + * Function: synchronize * * Purpose: * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -132,7 +132,7 @@ static void synchronize (void) { #ifdef H5_HAVE_SYSTEM -#if defined(_WIN32) && ! defined(__CYGWIN__) +#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__) _flushall(); #else HDsystem("sync"); @@ -143,15 +143,15 @@ synchronize (void) /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, March 12, 1998 * * Modifications: @@ -161,29 +161,29 @@ synchronize (void) int main (void) { - static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; - static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; + static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y}; + static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS; - unsigned char *the_data = NULL; - hid_t file, dset, file_space = -1; - herr_t status; + unsigned char *the_data = NULL; + hid_t file, dset, file_space = -1; + herr_t status; #ifdef H5_HAVE_GETRUSAGE - struct rusage r_start, r_stop; + struct rusage r_start, r_stop; #else struct timeval r_start, r_stop; #endif - struct timeval t_start, t_stop; - int fd; - unsigned u; - hssize_t n; - off_t offset; - hsize_t start[2]; - hsize_t count[2]; + struct timeval t_start, t_stop; + int fd; + unsigned u; + hssize_t n; + off_t offset; + hsize_t start[2]; + hsize_t count[2]; #ifdef H5_HAVE_SYS_TIMEB - struct _timeb *tbstart = malloc(sizeof(struct _timeb)); - struct _timeb *tbstop = malloc(sizeof(struct _timeb)); + struct _timeb *tbstart = malloc(sizeof(struct _timeb)); + struct _timeb *tbstop = malloc(sizeof(struct _timeb)); #endif /* * The extra cast in the following statement is a bug workaround for the @@ -191,7 +191,7 @@ main (void) * 1998-11-06 ptl */ printf ("I/O request size is %1.1fMB\n", - (double)(hssize_t)(size[0]*size[1])/1024.0*1024); + (double)(hssize_t)(size[0]*size[1])/1024.0*1024); /* Open the files */ file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -218,14 +218,14 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); + putc (PROGRESS, stderr); + HDfflush(stderr); + HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1])); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -234,17 +234,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("fill raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Fill hdf5 */ @@ -256,16 +256,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "fill hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -274,17 +274,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("fill hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Write the raw dataset */ synchronize (); @@ -295,17 +295,17 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out raw"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); - n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + putc (PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek (fd, (off_t)0, SEEK_SET); + assert (0==offset); + n = HDwrite (fd, the_data, (size_t)(size[0]*size[1])); + assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -314,17 +314,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("out raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Write the hdf5 dataset */ synchronize (); @@ -335,16 +335,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "out hdf5"); for(u = 0; u < nwrite; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -353,17 +353,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("out hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read the raw dataset */ synchronize (); @@ -374,17 +374,17 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in raw"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - offset = HDlseek (fd, (off_t)0, SEEK_SET); - assert (0==offset); - n = HDread (fd, the_data, (size_t)(size[0]*size[1])); - assert (n>=0 && (size_t)n==size[0]*size[1]); + putc (PROGRESS, stderr); + HDfflush(stderr); + offset = HDlseek (fd, (off_t)0, SEEK_SET); + assert (0==offset); + n = HDread (fd, the_data, (size_t)(size[0]*size[1])); + assert (n>=0 && (size_t)n==size[0]*size[1]); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -393,17 +393,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("in raw", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read the hdf5 dataset */ @@ -415,16 +415,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -433,17 +433,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc ('\n', stderr); print_stats ("in hdf5", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*size[0]*size[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*size[0]*size[1])); /* Read hyperslab */ assert (size[0]>20 && size[1]>20); @@ -459,16 +459,16 @@ main (void) HDgettimeofday(&t_start, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstart); + _ftime(tbstart); #endif #endif fprintf (stderr, HEADING, "in hdf5 partial"); for(u = 0; u < nread; u++) { - putc (PROGRESS, stderr); - HDfflush(stderr); - status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, - H5P_DEFAULT, the_data); - assert (status>=0); + putc (PROGRESS, stderr); + HDfflush(stderr); + status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space, + H5P_DEFAULT, the_data); + assert (status>=0); } #ifdef H5_HAVE_GETRUSAGE HDgetrusage(RUSAGE_SELF, &r_stop); @@ -477,17 +477,17 @@ main (void) HDgettimeofday(&t_stop, NULL); #else #ifdef H5_HAVE_SYS_TIMEB - _ftime(tbstop); - t_start.tv_sec = tbstart->time; - t_start.tv_usec = tbstart->millitm; - t_stop.tv_sec = tbstop->time; - t_stop.tv_usec = tbstop->millitm; + _ftime(tbstop); + t_start.tv_sec = tbstart->time; + t_start.tv_usec = tbstart->millitm; + t_stop.tv_sec = tbstop->time; + t_stop.tv_usec = tbstop->millitm; #endif #endif putc('\n', stderr); print_stats("in hdf5 partial", - &r_start, &r_stop, &t_start, &t_stop, - (size_t)(nread*count[0]*count[1])); + &r_start, &r_stop, &t_start, &t_stop, + (size_t)(nread*count[0]*count[1])); diff --git a/perform/mpi-perf.c b/perform/mpi-perf.c index c0fe794..a09d672 100644 --- a/perform/mpi-perf.c +++ b/perform/mpi-perf.c @@ -55,10 +55,19 @@ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> +#ifdef H5_HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include <string.h> -#include <sys/time.h> +#if defined(H5_TIME_WITH_SYS_TIME) +# include <sys/time.h> +# include <time.h> +#elif defined(H5_HAVE_SYS_TIME_H) +# include <sys/time.h> +#else +# include <time.h> +#endif #include <mpi.h> #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ # include <mpio.h> @@ -299,7 +308,7 @@ die_jar_jar_die: #if H5_HAVE_SETENV /* no setenv or unsetenv */ /* clear the environment variable if it was set earlier */ - if (opt_pvfstab_set){ + if (opt_pvfstab_set){ unsetenv("PVFSTAB_FILE"); } #endif diff --git a/perform/overhead.c b/perform/overhead.c index cfd96b8..0b40721 100644 --- a/perform/overhead.c +++ b/perform/overhead.c @@ -17,7 +17,7 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Monday, September 28, 1998 * - * Purpose: Creates a chunked dataset and measures the storage overhead. + * Purpose: Creates a chunked dataset and measures the storage overhead. */ /* See H5private.h for how to include headers */ @@ -54,12 +54,12 @@ # define UNUSED __attribute__((unused)) #endif -#define FILE_NAME_1 "overhead.h5" +#define FILE_NAME_1 "overhead.h5" #ifndef FALSE -#define FALSE 0 +#define FALSE 0 #endif /* FALSE */ #ifndef TRUE -#define TRUE 1 +#define TRUE 1 #endif /* TRUE */ typedef enum fill_t { @@ -73,13 +73,13 @@ typedef enum fill_t { /*------------------------------------------------------------------------- - * Function: usage + * Function: usage * - * Purpose: Prints a usage message and exits. + * Purpose: Prints a usage message and exits. * - * Return: never returns + * Return: never returns * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, September 30, 1998 * * Modifications: @@ -90,7 +90,7 @@ static void usage(const char *prog) { fprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", - prog); + prog); fprintf(stderr, "\ STYLE is the order that the dataset is filled and should be one of:\n\ forward -- Fill the dataset from lowest address to highest\n\ @@ -124,13 +124,13 @@ usage(const char *prog) /*------------------------------------------------------------------------- - * Function: cleanup + * Function: cleanup * - * Purpose: Removes test files + * Purpose: Removes test files * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 4, 1998 * * Modifications: @@ -141,22 +141,22 @@ static void cleanup (void) { if (!getenv ("HDF5_NOCLEANUP")) { - remove (FILE_NAME_1); + remove (FILE_NAME_1); } } /*------------------------------------------------------------------------- - * Function: display_error_cb + * Function: display_error_cb * - * Purpose: Displays the error stack after printing "*FAILED*". + * Purpose: Displays the error stack after printing "*FAILED*". * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, March 4, 1998 + * Programmer: Robb Matzke + * Wednesday, March 4, 1998 * * Modifications: * @@ -173,15 +173,15 @@ display_error_cb (hid_t estack, void UNUSED *client_data) /*------------------------------------------------------------------------- - * Function: test + * Function: test * - * Purpose: The guts of the test + * Purpose: The guts of the test * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, September 30, 1998 * * Modifications: @@ -192,25 +192,24 @@ static int test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc) { - hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1); - hsize_t ch_size[1] = {1}; /*chunk size */ - hsize_t cur_size[1] = {1000}; /*current dataset size */ - hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */ - hsize_t hs_start[1]; /*hyperslab start offset*/ - hsize_t hs_count[1] = {1}; /*hyperslab nelmts */ - int fd = (-1); /*h5 file direct */ - static int *had = NULL; /*for random filling */ - const char *sname=NULL; /*fill style nam */ - int mdc_nelmts; /*num meta objs to cache*/ - hsize_t i; - int j; - h5_stat_t sb; + hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1); + hsize_t ch_size[1] = {1}; /*chunk size */ + hsize_t cur_size[1] = {1000}; /*current dataset size */ + hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */ + hsize_t hs_start[1]; /*hyperslab start offset*/ + hsize_t hs_count[1] = {1}; /*hyperslab nelmts */ + int fd = (-1); /*h5 file direct */ + int *had = NULL; /*for random filling */ + const char *sname=NULL; /*fill style nam */ + int mdc_nelmts; /*num meta objs to cache*/ + hsize_t i; + int j; + h5_stat_t sb; - if(!had) had = calloc((size_t)cur_size[0], sizeof(int)); if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; if(!use_rdcc) { - if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error; - if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0) < 0) goto error; + if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error; + if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0) < 0) goto error; } if((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; @@ -220,60 +219,66 @@ test(fill_t fill_style, const double splits[], if((fspace = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; if((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0) goto error; if((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT, - fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error; + if(FILL_RANDOM==fill_style) + had = calloc((size_t)cur_size[0], sizeof(int)); + for (i=1; i<=cur_size[0]; i++) { - /* Decide which chunk to write to */ - switch (fill_style) { - case FILL_FORWARD: - hs_start[0] = i-1; - break; - case FILL_REVERSE: - hs_start[0] = cur_size[0]-i; - break; - case FILL_INWARD: - hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2; - break; - case FILL_OUTWARD: - j = (int)(cur_size[0]-i)+1; - hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; - break; - case FILL_RANDOM: - for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0]) /*void*/; - hs_start[0] = j; - had[j] = 1; - break; - case FILL_ALL: - abort(); - } - - /* Write the chunk */ - if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL, - hs_count, NULL) < 0) goto error; - if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, xfer, &i) < 0) { - goto error; - } - - - /* Determine overhead */ - if (verbose) { - if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; - if (HDfstat(fd, &sb) < 0) goto error; - /* - * The extra cast in the following statement is a bug workaround - * for the Win32 version 5.0 compiler. - * 1998-11-06 ptl - */ - printf("%4lu %8.3f ***\n", - (unsigned long)i, - (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); - } - - + /* Decide which chunk to write to */ + switch (fill_style) { + case FILL_FORWARD: + hs_start[0] = i-1; + break; + case FILL_REVERSE: + hs_start[0] = cur_size[0]-i; + break; + case FILL_INWARD: + hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2; + break; + case FILL_OUTWARD: + j = (int)(cur_size[0]-i)+1; + hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; + break; + case FILL_RANDOM: + for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0]) + /*void*/; + hs_start[0] = j; + had[j] = 1; + break; + case FILL_ALL: + abort(); + } + + /* Write the chunk */ + if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL, + hs_count, NULL) < 0) goto error; + if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, xfer, &i) < 0) { + goto error; + } + + /* Determine overhead */ + if (verbose) { + if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; + if (HDfstat(fd, &sb) < 0) goto error; + /* + * The extra cast in the following statement is a bug workaround + * for the Win32 version 5.0 compiler. + * 1998-11-06 ptl + */ + printf("%4lu %8.3f ***\n", + (unsigned long)i, + (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); + } } + if(had) { + free(had); + had = NULL; + } /* end if */ + H5Dclose(dset); H5Sclose(mspace); H5Sclose(fspace); @@ -282,33 +287,31 @@ test(fill_t fill_style, const double splits[], H5Fclose(file); if (!verbose) { - switch (fill_style) { - case FILL_FORWARD: - sname = "forward"; - break; - case FILL_REVERSE: - sname = "reverse"; - break; - case FILL_INWARD: - sname = "inward"; - break; - case FILL_OUTWARD: - sname = "outward"; - break; - case FILL_RANDOM: - sname = "random"; - break; - case FILL_ALL: - abort(); - } - - if (HDfstat(fd, &sb) < 0) goto error; - printf("%-7s %8.3f\n", sname, - (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ - (hssize_t)cur_size[0]); + switch (fill_style) { + case FILL_FORWARD: + sname = "forward"; + break; + case FILL_REVERSE: + sname = "reverse"; + break; + case FILL_INWARD: + sname = "inward"; + break; + case FILL_OUTWARD: + sname = "outward"; + break; + case FILL_RANDOM: + sname = "random"; + break; + case FILL_ALL: + abort(); + } + + if (HDfstat(fd, &sb) < 0) goto error; + printf("%-7s %8.3f\n", sname, + (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ + (hssize_t)cur_size[0]); } - - HDclose(fd); return 0; @@ -320,22 +323,23 @@ test(fill_t fill_style, const double splits[], H5Pclose(dcpl); H5Pclose(xfer); H5Fclose(file); - free(had); + if(had) + free(had); HDclose(fd); return 1; } /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: * - * Return: Success: zero + * Return: Success: zero * - * Failure: non-zero + * Failure: non-zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, September 28, 1998 * * Modifications: @@ -345,11 +349,11 @@ test(fill_t fill_style, const double splits[], int main(int argc, char *argv[]) { - hid_t xfer; - fill_t fill_style = FILL_ALL; - hbool_t use_cache = FALSE; - double splits[3]; - int i, j, nerrors=0; + hid_t xfer; + fill_t fill_style = FILL_ALL; + hbool_t use_cache = FALSE; + double splits[3]; + int i, j, nerrors=0; /* Default split ratios */ H5Eset_auto2(H5E_DEFAULT, display_error_cb, NULL); @@ -360,36 +364,37 @@ main(int argc, char *argv[]) /* Parse command-line options */ for(i = 1, j = 0; i < argc; i++) { - if (!strcmp(argv[i], "forward")) { - fill_style = FILL_FORWARD; - } else if (!strcmp(argv[i], "reverse")) { - fill_style = FILL_REVERSE; - } else if (!strcmp(argv[i], "inward")) { - fill_style = FILL_INWARD; - } else if (!strcmp(argv[i], "outward")) { - fill_style = FILL_OUTWARD; - } else if (!strcmp(argv[i], "random")) { - fill_style = FILL_RANDOM; - } else if (!strcmp(argv[i], "cache")) { - use_cache = TRUE; - } else if (j<3 && (isdigit(argv[i][0]) || '.'==argv[i][0])) { - splits[j++] = strtod(argv[i], NULL); - } else { - usage(argv[0]); - } + if (!strcmp(argv[i], "forward")) { + fill_style = FILL_FORWARD; + } else if (!strcmp(argv[i], "reverse")) { + fill_style = FILL_REVERSE; + } else if (!strcmp(argv[i], "inward")) { + fill_style = FILL_INWARD; + } else if (!strcmp(argv[i], "outward")) { + fill_style = FILL_OUTWARD; + } else if (!strcmp(argv[i], "random")) { + fill_style = FILL_RANDOM; + } else if (!strcmp(argv[i], "cache")) { + use_cache = TRUE; + } else if (j<3 && (isdigit(argv[i][0]) || '.'==argv[i][0])) { + splits[j++] = strtod(argv[i], NULL); + } else { + usage(argv[0]); + } } if (FILL_ALL==fill_style) { - printf("%-7s %8s\n", "Style", "Bytes/Chunk"); - printf("%-7s %8s\n", "-----", "-----------"); - nerrors += test(FILL_FORWARD, splits, FALSE, use_cache); - nerrors += test(FILL_REVERSE, splits, FALSE, use_cache); - nerrors += test(FILL_INWARD, splits, FALSE, use_cache); - nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache); - nerrors += test(FILL_RANDOM, splits, FALSE, use_cache); - } else { - if (use_cache) usage(argv[0]); - nerrors += test(fill_style, splits, TRUE, FALSE); + printf("%-7s %8s\n", "Style", "Bytes/Chunk"); + printf("%-7s %8s\n", "-----", "-----------"); + nerrors += test(FILL_FORWARD, splits, FALSE, use_cache); + nerrors += test(FILL_REVERSE, splits, FALSE, use_cache); + nerrors += test(FILL_INWARD, splits, FALSE, use_cache); + nerrors += test(FILL_OUTWARD, splits, FALSE, use_cache); + nerrors += test(FILL_RANDOM, splits, FALSE, use_cache); + } + else { + if (use_cache) usage(argv[0]); + nerrors += test(fill_style, splits, TRUE, FALSE); } if (nerrors>0) goto error; cleanup(); diff --git a/perform/perf.c b/perform/perf.c index 92b85bc..f006afb 100644 --- a/perform/perf.c +++ b/perform/perf.c @@ -28,10 +28,19 @@ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> +#ifdef H5_HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include <string.h> -#include <sys/time.h> +#if defined(H5_TIME_WITH_SYS_TIME) +# include <sys/time.h> +# include <time.h> +#elif defined(H5_HAVE_SYS_TIME_H) +# include <sys/time.h> +#else +# include <time.h> +#endif #include <mpi.h> #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ # include <mpio.h> @@ -45,30 +54,30 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ - fflush(stdout); \ - goto die_jar_jar_die; \ - } \ + mesg, (int)__LINE__, __FILE__); \ + if (fatal){ \ + fflush(stdout); \ + goto die_jar_jar_die; \ + } \ } \ } while(0) #define RANK 1 -hsize_t dims[RANK]; /* dataset dim sizes */ +hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t block[RANK], stride[RANK], count[RANK]; hssize_t start[RANK]; hid_t fid; /* HDF5 file ID */ -hid_t acc_tpl; /* File access templates */ -hid_t sid; /* Dataspace ID */ -hid_t file_dataspace; /* File dataspace ID */ -hid_t mem_dataspace; /* memory dataspace ID */ -hid_t dataset; /* Dataset ID */ -hsize_t opt_alignment = 1; -hsize_t opt_threshold = 1; -int opt_split_vfd = 0; -char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */ - /* opt_split_vfd is set */ +hid_t acc_tpl; /* File access templates */ +hid_t sid; /* Dataspace ID */ +hid_t file_dataspace; /* File dataspace ID */ +hid_t mem_dataspace; /* memory dataspace ID */ +hid_t dataset; /* Dataset ID */ +hsize_t opt_alignment = 1; +hsize_t opt_threshold = 1; +int opt_split_vfd = 0; +char *meta_ext, *raw_ext; /* holds the meta and raw file extension if */ + /* opt_split_vfd is set */ /* DEFAULT VALUES FOR OPTIONS */ @@ -105,7 +114,7 @@ int main(int argc, char **argv) MPI_File fh; MPI_Status status; int nchars; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* startup MPI and determine the rank of this process */ MPI_Init(&argc,&argv); @@ -155,38 +164,38 @@ int main(int argc, char **argv) /* setup file access template with parallel IO access. */ if (opt_split_vfd){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } - - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); - ret = H5Pclose(mpio_pl); - VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } + + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL); + ret = H5Pclose(mpio_pl); + VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL); }else{ - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "", H5FATAL); - ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); - VRFY((ret >= 0), "", H5FATAL); - - /* set optional allocation alignment */ - if (opt_alignment*opt_threshold != 1){ - ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); - VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); - } + /* setup file access template */ + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((acc_tpl >= 0), "", H5FATAL); + ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL); + VRFY((ret >= 0), "", H5FATAL); + + /* set optional allocation alignment */ + if (opt_alignment*opt_threshold != 1){ + ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment ); + VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL); + } } /* create the parallel file */ @@ -198,7 +207,7 @@ int main(int argc, char **argv) sid = H5Screate_simple(RANK, dims, NULL); VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL); dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL); /* create the memory dataspace and the file dataspace */ @@ -366,7 +375,7 @@ die_jar_jar_die: #if H5_HAVE_SETENV /* no setenv or unsetenv */ /* clear the environment variable if it was set earlier */ - if (opt_pvfstab_set){ + if (opt_pvfstab_set){ unsetenv("PVFSTAB_FILE"); } #endif diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 27606d0..0e3190c 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -22,7 +22,9 @@ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> +#ifdef H5_HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include "hdf5.h" @@ -318,22 +320,22 @@ do_pio(parameters param) /* Need barrier to make sure everyone starts at the same time */ MPI_Barrier(pio_comm_g); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); hrc == SUCCESS; - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -347,20 +349,20 @@ do_pio(parameters param) MPI_Barrier(pio_comm_g); /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -411,14 +413,14 @@ done: static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size) { - const char *prefix, *suffix=""; + const char *prefix, *suffix = ""; char *ptr, last = '\0'; size_t i, j; if (!base_name || !fullname || size < 1) - return NULL; + return NULL; - memset(fullname, 0, size); + HDmemset(fullname, 0, size); switch (iot) { case POSIXIO: @@ -433,77 +435,81 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si } /* First use the environment variable and then try the constant */ - prefix = getenv("HDF5_PARAPREFIX"); + prefix = HDgetenv("HDF5_PARAPREFIX"); #ifdef HDF5_PARAPREFIX if (!prefix) - prefix = HDF5_PARAPREFIX; + prefix = HDF5_PARAPREFIX; #endif /* HDF5_PARAPREFIX */ /* Prepend the prefix value to the base name */ if (prefix && *prefix) { - /* If the prefix specifies the HDF5_PARAPREFIX directory, then - * default to using the "/tmp/$USER" or "/tmp/$LOGIN" - * directory instead. */ - register char *user, *login, *subdir; - - user = getenv("USER"); - login = getenv("LOGIN"); - subdir = (user ? user : login); + /* If the prefix specifies the HDF5_PARAPREFIX directory, then + * default to using the "/tmp/$USER" or "/tmp/$LOGIN" + * directory instead. */ + register char *user, *login, *subdir; - if (subdir) { - for (i = 0; i < size && prefix[i]; i++) - fullname[i] = prefix[i]; + user = HDgetenv("USER"); + login = HDgetenv("LOGIN"); + subdir = (user ? user : login); - fullname[i++] = '/'; + if (subdir) { + for (i = 0; i < size && prefix[i]; i++) + fullname[i] = prefix[i]; - for (j = 0; i < size && subdir[j]; i++, j++) - fullname[i] = subdir[j]; - } else { - /* We didn't append the prefix yet */ - strncpy(fullname, prefix, MIN(strlen(prefix), size)); - } + fullname[i++] = '/'; - if ((strlen(fullname) + strlen(base_name) + 1) < size) { - /* Append the base_name with a slash first. Multiple slashes are - * handled below. */ - h5_stat_t buf; - - if (HDstat(fullname, &buf) < 0) - /* The directory doesn't exist just yet */ - if (mkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) { - /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. - * Default to PREFIX's original prefix value. */ - strcpy(fullname, prefix); + for (j = 0; i < size && subdir[j]; i++, j++) + fullname[i] = subdir[j]; + } + else { + /* We didn't append the prefix yet */ + HDstrncpy(fullname, prefix, MIN(HDstrlen(prefix), size)); } - strcat(fullname, "/"); - strcat(fullname, base_name); - } else { + if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) { + /* Append the base_name with a slash first. Multiple slashes are + * handled below. */ + h5_stat_t buf; + + if (HDstat(fullname, &buf) < 0) + /* The directory doesn't exist just yet */ + if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) { + /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory. + * Default to PREFIX's original prefix value. */ + HDstrcpy(fullname, prefix); + } + + HDstrcat(fullname, "/"); + HDstrcat(fullname, base_name); + } + else { + /* Buffer is too small */ + return NULL; + } + } + else if (HDstrlen(base_name) >= size) { /* Buffer is too small */ return NULL; } - } else if (strlen(base_name) >= size) { - /* Buffer is too small */ - return NULL; - } else { - strcpy(fullname, base_name); + else { + HDstrcpy(fullname, base_name); } /* Append a suffix */ if (suffix) { - if (strlen(fullname) + strlen(suffix) >= size) - return NULL; + if (HDstrlen(fullname) + HDstrlen(suffix) >= size) + return NULL; - strcat(fullname, suffix); + HDstrcat(fullname, suffix); } /* Remove any double slashes in the filename */ for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) { - if (*ptr != '/' || last != '/') - fullname[j++] = *ptr; + if (*ptr != '/' || last != '/') + fullname[j++] = *ptr; - last = *ptr; + last = *ptr; } return fullname; @@ -962,7 +968,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Write */ @@ -1393,7 +1399,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -1893,7 +1899,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Read */ @@ -2348,7 +2354,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ @@ -3109,9 +3115,9 @@ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, START); + set_time(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, STOP); + set_time(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -3120,9 +3126,9 @@ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, START); + set_time(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, STOP); + set_time(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -3130,9 +3136,9 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, START); + set_time(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, STOP); + set_time(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } @@ -3140,9 +3146,9 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, START); + set_time(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, STOP); + set_time(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } diff --git a/perform/pio_perf.c b/perform/pio_perf.c index d3e2531..337e982 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -339,6 +339,11 @@ main(int argc, char **argv) int exit_value = EXIT_SUCCESS; struct options *opts = NULL; +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + output = stdout; /* initialize MPI and get the maximum num of processors we started with */ @@ -1312,11 +1317,11 @@ parse_command_line(int argc, char *argv[]) if (isalnum(*end) && i < 10) buf[i++] = *end; - if (!strcasecmp(buf, "phdf5")) { + if (!HDstrcasecmp(buf, "phdf5")) { cl_opts->io_types |= PIO_HDF5; - } else if (!strcasecmp(buf, "mpiio")) { + } else if (!HDstrcasecmp(buf, "mpiio")) { cl_opts->io_types |= PIO_MPI; - } else if (!strcasecmp(buf, "posix")) { + } else if (!HDstrcasecmp(buf, "posix")) { cl_opts->io_types |= PIO_POSIX; } else { fprintf(stderr, "pio_perf: invalid --api option %s\n", diff --git a/perform/pio_perf.h b/perform/pio_perf.h index f9a8e03..094b31d 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -16,14 +16,15 @@ #ifndef PIO_PERF_H__ #define PIO_PERF_H__ -#include "pio_timer.h" #ifndef STANDALONE #include "H5private.h" #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #else #include "pio_standalone.h" #endif +#include "pio_timer.h" /* setup the dataset no fill option if this is v1.5 or more */ #if H5_VERS_MAJOR > 1 || H5_VERS_MINOR > 4 diff --git a/perform/pio_standalone.h b/perform/pio_standalone.h index a4bc8b5..584a057 100644 --- a/perform/pio_standalone.h +++ b/perform/pio_standalone.h @@ -22,7 +22,7 @@ /** From H5private.h **/ -#include "H5public.h" /* Include Public Definitions */ +#include "H5public.h" /* Include Public Definitions */ /* @@ -47,57 +47,57 @@ * And now for a couple non-Posix functions... Watch out for systems that * define these in terms of macros. */ -#ifdef _WIN32 -#define HDstrdup(S) _strdup(S) -#else /* _WIN32 */ +#ifdef H5_HAVE_WIN32_API +#define HDstrdup(S) _strdup(S) +#else /* H5_HAVE_WIN32_API */ #if !defined strdup && !defined H5_HAVE_STRDUP extern char *strdup(const char *s); #endif -#define HDstrdup(S) strdup(S) +#define HDstrdup(S) strdup(S) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); -#define HDstrcmp(S,T) strcmp(S,T) -#define HDstrlen(S) strlen(S) -#define HDstrncmp(S,T,L) strncmp(S,T,L) -#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) -#define HDstrchr(S,C) strchr(S,C) -#define HDfree(M) free(M) +#define HDstrcmp(S,T) strcmp(S,T) +#define HDstrlen(S) strlen(S) +#define HDstrncmp(S,T,L) strncmp(S,T,L) +#define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) +#define HDstrchr(S,C) strchr(S,C) +#define HDfree(M) free(M) #ifdef _O_BINARY -#define HDopen(S,F,M) open(S,F|_O_BINARY,M) +#define HDopen(S,F,M) open(S,F|_O_BINARY,M) #else -#define HDopen(S,F,M) open(S,F,M) +#define HDopen(S,F,M) open(S,F,M) #endif -#define HDclose(F) close(F) +#define HDclose(F) close(F) -#ifdef _WIN32 -#define HDlseek(F,O,W) _lseeki64(F,O,W) +#ifdef H5_HAVE_WIN32_API +#define HDlseek(F,O,W) _lseeki64(F,O,W) #else -#define HDlseek(F,O,W) lseek(F,O,W) +#define HDlseek(F,O,W) lseek(F,O,W) #endif -#define HDwrite(F,M,Z) write(F,M,Z) +#define HDwrite(F,M,Z) write(F,M,Z) -#define HDread(F,M,Z) read(F,M,Z) +#define HDread(F,M,Z) read(F,M,Z) -#ifdef _WIN32 - #define HDstat(S,B) _stati64(S,B) +#ifdef H5_HAVE_WIN32_API + #define HDstat(S,B) _stati64(S,B) #else #define HDstat(S,B) stat(S,B) #endif -#ifdef _WIN32 -#define HDfstat(F,B) _fstati64(F,B) -typedef struct _stati64 h5_stat_t; -typedef __int64 h5_stat_size_t; +#ifdef H5_HAVE_WIN32_API +#define HDfstat(F,B) _fstati64(F,B) +typedef struct _stati64 h5_stat_t; +typedef __int64 h5_stat_size_t; #else #define HDfstat(F,B) fstat(F,B) -typedef struct stat h5_stat_t; +typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; #endif @@ -134,7 +134,7 @@ extern const char *opt_arg; /* flag argument (or value) */ enum { no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ + require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; diff --git a/perform/pio_timer.c b/perform/pio_timer.c index 66f9eb0..aba219e 100644 --- a/perform/pio_timer.c +++ b/perform/pio_timer.c @@ -22,7 +22,7 @@ #include <stdio.h> #include <stdlib.h> -#include "pio_timer.h" +#include "hdf5.h" #ifdef H5_HAVE_PARALLEL @@ -43,15 +43,15 @@ pio_time *timer_g; /* timer: global for stub functions */ * Function: sub_time * Purpose: Struct two time values, and return the difference, in microseconds * - * Note that the function assumes that a > b + * Note that the function assumes that a > b * Programmer: Leon Arber, 1/27/06 */ static double sub_time(struct timeval* a, struct timeval* b) { return (((double)a->tv_sec + ((double)a->tv_usec) / MICROSECOND) - - ((double)b->tv_sec + - ((double)b->tv_usec) / MICROSECOND)); + ((double)b->tv_sec + + ((double)b->tv_usec) / MICROSECOND)); } @@ -89,7 +89,7 @@ pio_time_new(clock_type type) void pio_time_destroy(pio_time *pt) { - free(pt); + HDfree(pt); /* reset the global timer pointer too. */ timer_g = NULL; } @@ -134,43 +134,43 @@ set_time(pio_time *pt, timer_type t, int start_stop) { if (pt) { if (pt->type == MPI_TIMER) { - if (start_stop == START) { + 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]; + /* 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]; + 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]; } } else { - if (start_stop == START) { - gettimeofday(&pt->sys_timer[t], NULL); + 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 { struct timeval sys_t; - gettimeofday(&sys_t, NULL); + HDgettimeofday(&sys_t, NULL); pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t])); /* ((double)sys_t.tv_sec + @@ -178,12 +178,12 @@ set_time(pio_time *pt, timer_type t, int start_stop) ((double)pt->sys_timer[t].tv_sec + ((double)pt->sys_timer[t].tv_usec) / MICROSECOND);*/ - /* 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])); } } @@ -231,7 +231,7 @@ set_time(pio_time *pt, timer_type t, int start_stop) } fprintf(output, " Proc %d: %s %s: %.2f\n", myrank, msg, - (start_stop == START ? "Start" : "Stop"), + (start_stop == TSTART ? "Start" : "Stop"), pt->total_time[t]); } } diff --git a/perform/pio_timer.h b/perform/pio_timer.h index 943521a..a5ee6d7 100644 --- a/perform/pio_timer.h +++ b/perform/pio_timer.h @@ -53,8 +53,8 @@ typedef enum clock_type_ { /* Miscellaneous identifiers */ enum { - START, /* Start a specified timer */ - STOP /* Stop a specified timer */ + TSTART, /* Start a specified timer */ + TSTOP /* Stop a specified timer */ }; /* The performance time structure */ diff --git a/perform/sio_engine.c b/perform/sio_engine.c index e892bcc..df2e21e 100644 --- a/perform/sio_engine.c +++ b/perform/sio_engine.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <fcntl.h> #ifdef H5_HAVE_UNISTD_H -# include <unistd.h> +# include <unistd.h> #endif #include <errno.h> @@ -233,18 +233,18 @@ do_sio(parameters param) HDfprintf(output, "data filename=%s\n", fname); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, buffer); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -253,19 +253,19 @@ do_sio(parameters param) */ /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, START); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, STOP); + set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -551,7 +551,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); /* Perform write */ hrc = dset_write(rank-1, fd, parms, buffer); @@ -563,7 +563,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -628,7 +628,7 @@ static herr_t dset_write(int local_dim, file_descr *fd, parameters *parms, void int cur_dim = order[local_dim]-1; int ret_code = SUCCESS; int k; - hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; + hsize_t dims[MAX_DIMS], maxdims[MAX_DIMS]; long i,j; herr_t hrc; @@ -855,7 +855,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end switch */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, START); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { @@ -864,7 +864,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, STOP); + set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ diff --git a/perform/sio_perf.c b/perform/sio_perf.c index d852a45..16e1750 100644 --- a/perform/sio_perf.c +++ b/perform/sio_perf.c @@ -343,6 +343,11 @@ main(int argc, char **argv) int exit_value = EXIT_SUCCESS; struct options *opts = NULL; +#ifndef STANDALONE + /* Initialize h5tools lib */ + h5tools_init(); +#endif + output = stdout; opts = parse_command_line(argc, argv); diff --git a/perform/sio_perf.h b/perform/sio_perf.h index 2417b6f..3e4456a 100644 --- a/perform/sio_perf.h +++ b/perform/sio_perf.h @@ -19,6 +19,7 @@ #ifndef STANDALONE #include "H5private.h" #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #else #include "sio_standalone.h" @@ -49,24 +50,24 @@ typedef enum vfdtype_ { } vfdtype; typedef struct parameters_ { - iotype io_type; /* The type of IO test to perform */ + iotype io_type; /* The type of IO test to perform */ vfdtype vfd; - long num_files; /* Number of files to create */ - long num_dsets; /* Number of datasets to create */ - off_t num_bytes; /* Number of bytes in each dset */ + long num_files; /* Number of files to create */ + long num_dsets; /* Number of datasets to create */ + off_t num_bytes; /* Number of bytes in each dset */ int num_iters; /* Number of times to loop doing the IO */ int rank; /* Rank of dataset */ - off_t dset_size[MAX_DIMS]; /* Dataset size */ - size_t buf_size[MAX_DIMS]; /* Buffer size */ - size_t chk_size[MAX_DIMS]; /* Chunk size */ - int order[MAX_DIMS]; /* Buffer size */ - hsize_t h5_align; /* HDF5 object alignment */ - hsize_t h5_thresh; /* HDF5 object alignment threshold */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_extendable; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ + off_t dset_size[MAX_DIMS]; /* Dataset size */ + size_t buf_size[MAX_DIMS]; /* Buffer size */ + size_t chk_size[MAX_DIMS]; /* Chunk size */ + int order[MAX_DIMS]; /* Buffer size */ + hsize_t h5_align; /* HDF5 object alignment */ + hsize_t h5_thresh; /* HDF5 object alignment threshold */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_extendable; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ unsigned h5_use_mpi_posix; /* VFD for HDF5 I/O */ - int verify; /* Verify data correctness */ + int verify; /* Verify data correctness */ } parameters; typedef struct results_ { diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h index 77bb7f8..677a8ae 100644 --- a/perform/sio_standalone.h +++ b/perform/sio_standalone.h @@ -21,7 +21,7 @@ /** From H5private.h **/ -#include "H5public.h" /* Include Public Definitions */ +#include "H5public.h" /* Include Public Definitions */ /* @@ -129,11 +129,11 @@ #define HDfgetc(F) fgetc(F) #define HDfgetpos(F,P) fgetpos(F,P) #define HDfgets(S,N,F) fgets(S,N,F) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDfileno(F) _fileno(F) -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #define HDfileno(F) fileno(F) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ #define HDfloor(X) floor(X) #define HDfmod(X,Y) fmod(X,Y) #define HDfopen(S,M) fopen(S,M) @@ -169,7 +169,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); * For Unix, if off_t is not 64bit big, try use the pseudo-standard * xxx64 versions if available. */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDfstat(F,B) _fstati64(F,B) #define HDlstat(S,B) _lstati64(S,B) #define HDstat(S,B) _stati64(S,B) @@ -202,7 +202,11 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgetgrgid(G) getgrgid(G) #define HDgetgrnam(S) getgrnam(S) #define HDgetgroups(Z,G) getgroups(Z,G) +#ifdef H5_HAVE_VISUAL_STUDIO +#define HDgetlogin() Wgetlogin() +#else /* H5_HAVE_VISUAL_STUDIO */ #define HDgetlogin() getlogin() +#endif /* H5_HAVE_VISUAL_STUDIO */ #define HDgetpgrp() getpgrp() #define HDgetpid() getpid() #define HDgetppid() getppid() @@ -235,7 +239,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDlog(X) log(X) #define HDlog10(X) log10(X) #define HDlongjmp(J,N) longjmp(J,N) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDlseek(F,O,W) _lseeki64(F,O,W) #else #ifdef H5_HAVE_LSEEK64 @@ -258,18 +262,18 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z) /* - * The (void*) cast just avoids a compiler warning in _WIN32 + * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO */ -#ifdef _WIN32 +#ifdef H5_HAVE_VISUAL_STUDIO #define HDmemset(X,C,Z) memset((void*)(X),C,Z) -#else /* _WIN32 */ +#else /* H5_HAVE_VISUAL_STUDIO */ #define HDmemset(X,C,Z) memset(X,C,Z) -#endif /* _WIN32 */ -#ifdef _WIN32 +#endif /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_WIN32_API #define HDmkdir(S,M) _mkdir(S) -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #define HDmkdir(S,M) mkdir(S,M) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ #define HDmkfifo(S,M) mkfifo(S,M) #define HDmktime(T) mktime(T) #define HDmodf(X,Y) modf(X,Y) @@ -331,7 +335,7 @@ int HDremove_all(const char * fname); #define HDsetuid(U) setuid(U) /* Windows does not permit setting the buffer size to values less than 2. */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) #else #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) @@ -350,7 +354,7 @@ int HDremove_all(const char * fname); #define HDsin(X) sin(X) #define HDsinh(X) sinh(X) #define HDsleep(N) sleep(N) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDsnprintf _snprintf /*varargs*/ #else #define HDsnprintf snprintf /*varargs*/ @@ -369,7 +373,7 @@ H5_DLL void HDsrand(unsigned int seed); #endif /* sscanf() variable arguments */ -#define HDstrcasecmp(X,Y) strcasecmp(X,Y) +#define HDstrcasecmp(X,Y) strcasecmp(X,Y) #define HDstrcat(X,Y) strcat(X,Y) #define HDstrchr(S,C) strchr(S,C) #define HDstrcmp(X,Y) strcmp(X,Y) @@ -415,7 +419,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDumask(N) umask(N) #define HDuname(S) uname(S) #define HDungetc(C,F) ungetc(C,F) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDunlink(S) _unlink(S) #else #define HDunlink(S) unlink(S) @@ -428,7 +432,7 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) #define HDvprintf(FMT,A) vprintf(FMT,A) #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API # define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) #else # define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A) @@ -443,9 +447,9 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); * And now for a couple non-Posix functions... Watch out for systems that * define these in terms of macros. */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #define HDstrdup(S) _strdup(S) -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #if !defined strdup && !defined H5_HAVE_STRDUP extern char *strdup(const char *s); @@ -453,7 +457,7 @@ extern char *strdup(const char *s); #define HDstrdup(S) strdup(S) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* * HDF Boolean type. @@ -487,7 +491,7 @@ extern const char *opt_arg; /* flag argument (or value) */ enum { no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ + require_arg, /* requires an argument */ optional_arg /* argument is optional */ }; diff --git a/perform/sio_timer.c b/perform/sio_timer.c index f188a10..f233de3 100644 --- a/perform/sio_timer.c +++ b/perform/sio_timer.c @@ -39,15 +39,15 @@ sio_time *timer_g; /* timer: global for stub functions */ * Function: sub_time
* Purpose: Struct two time values, and return the difference, in microseconds
*
- * Note that the function assumes that a > b
+ * Note that the function assumes that a > b
* Programmer: Leon Arber, 1/27/06
*/
static double sub_time(struct timeval* a, struct timeval* b)
{
return (((double)a->tv_sec +
((double)a->tv_usec) / MICROSECOND) -
- ((double)b->tv_sec +
- ((double)b->tv_usec) / MICROSECOND));
+ ((double)b->tv_sec +
+ ((double)b->tv_usec) / MICROSECOND));
}
@@ -82,7 +82,7 @@ sio_time_new(void) void
sio_time_destroy(sio_time *pt)
{
- free(pt);
+ HDfree(pt);
/* reset the global timer pointer too. */
timer_g = NULL;
}
@@ -100,15 +100,15 @@ sio_time * set_time(sio_time *pt, timer_type t, int start_stop)
{
if (pt) {
- if (start_stop == START) {
+ 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 {
@@ -122,12 +122,12 @@ set_time(sio_time *pt, timer_type t, int start_stop) ((double)pt->sys_timer[t].tv_sec +
((double)pt->sys_timer[t].tv_usec) / MICROSECOND);*/
- /* 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]));
}
@@ -171,7 +171,7 @@ set_time(sio_time *pt, timer_type t, int start_stop) }
fprintf(output, " %s %s: %.2f\n", msg,
- (start_stop == START ? "Start" : "Stop"),
+ (start_stop == TSTART ? "Start" : "Stop"),
pt->total_time[t]);
}
}
diff --git a/perform/sio_timer.h b/perform/sio_timer.h index 1fa880d..04432af 100644 --- a/perform/sio_timer.h +++ b/perform/sio_timer.h @@ -27,7 +27,7 @@ #endif #ifdef H5_HAVE_WINSOCK_H -# include <winsock2.h> +# include <winsock2.h> #endif /* H5_HAVE_WINSOCK_H */ /* The different types of timers we can have */ @@ -52,8 +52,8 @@ typedef enum timer_type_ { /* Miscellaneous identifiers */ enum { - START, /* Start a specified timer */ - STOP /* Stop a specified timer */ + TSTART, /* Start a specified timer */ + TSTOP /* Stop a specified timer */ }; /* The performance time structure */ diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 5729baf..585dc13 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -23,6 +23,7 @@ /* our header files */ #include "h5test.h" +#include "h5tools.h" #include "h5tools_utils.h" #ifdef H5_HAVE_FILTER_DEFLATE @@ -66,9 +67,9 @@ #endif /* internal variables */ -static const char *prog; -static const char *option_prefix; -static char *filename; +static const char *prog=NULL; +static const char *option_prefix=NULL; +static char *filename=NULL; static int compress_percent = 0; static int compress_level = Z_DEFAULT_COMPRESSION; static int output, random_test = FALSE; @@ -175,6 +176,7 @@ cleanup(void) { if (!getenv("HDF5_NOCLEANUP")) unlink(filename); + free(filename); } static void @@ -292,10 +294,11 @@ uncompress_buffer(Bytef *dest, uLongf *destLen, const Bytef *source, * Programmer: Bill Wendling, 06. June 2002 * Modifications: */ +#define ZIP_PERF_FILE "zip_perf.data" static void get_unique_name(void) { - const char *prefix = NULL, *tmpl = "zip_perf.data"; + const char *prefix = NULL; const char *env = getenv("HDF5_PREFIX"); if (env) @@ -305,19 +308,20 @@ get_unique_name(void) prefix = option_prefix; if (prefix) - /* 2 = 1 for '/' + 1 for null terminator */ - filename = (char *) HDmalloc(strlen(prefix) + strlen(tmpl) + 2); + /* 2 = 1 for '/' + 1 for null terminator */ + filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2); else - filename = (char *) HDmalloc(strlen(tmpl) + 1); + filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1); if (!filename) error("out of memory"); + filename[0] = 0; if (prefix){ - strcpy(filename, prefix); - strcat(filename, "/"); + strcpy(filename, prefix); + strcat(filename, "/"); } - strcat(filename, tmpl); + strcat(filename, ZIP_PERF_FILE); } /* @@ -410,7 +414,7 @@ fill_with_random_data(Bytef *src, uLongf src_len) register unsigned u; h5_stat_t stat_buf; - if (stat("/dev/urandom", &stat_buf) == 0) { + if (HDstat("/dev/urandom", &stat_buf) == 0) { uLongf len = src_len; Bytef *buf = src; int fd = HDopen("/dev/urandom", O_RDONLY, 0); @@ -570,6 +574,9 @@ main(int argc, char **argv) int opt; prog = argv[0]; + + /* Initialize h5tools lib */ + h5tools_init(); while ((opt = get_option(argc, (const char **)argv, s_opts, l_opts)) > 0) { switch ((char)opt) { |