diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-01-09 22:00:04 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-01-09 22:00:13 (GMT) |
commit | 9b82f8c0ac010b019f1cfc98c638c7ec6770a844 (patch) | |
tree | 94ade8785903c149c014fa691067e654adb1973f | |
parent | 99fa2dbec3d707b47032c3ad4fb1b6cf80cec25e (diff) | |
download | hdf5-9b82f8c0ac010b019f1cfc98c638c7ec6770a844.zip hdf5-9b82f8c0ac010b019f1cfc98c638c7ec6770a844.tar.gz hdf5-9b82f8c0ac010b019f1cfc98c638c7ec6770a844.tar.bz2 |
Fix standalone compile issues
-rw-r--r-- | tools/lib/io_timer.c | 85 | ||||
-rw-r--r-- | tools/test/perform/pio_perf.h | 3 | ||||
-rw-r--r-- | tools/test/perform/pio_standalone.c | 132 | ||||
-rw-r--r-- | tools/test/perform/sio_perf.h | 4 |
4 files changed, 176 insertions, 48 deletions
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index cb89019..472824b 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/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h index 7605f20..55d721e 100644 --- a/tools/test/perform/pio_perf.h +++ b/tools/test/perform/pio_perf.h @@ -13,12 +13,13 @@ #ifndef PIO_PERF_H__ #define PIO_PERF_H__ -#include "io_timer.h" #ifndef STANDALONE +#include "io_timer.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" #else +#include "io_timer.h" #include "pio_standalone.h" #endif diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index 0fba904..8cdca85 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -164,3 +164,135 @@ print_version(const char *progname) progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE); } + +#ifdef STANDALONE +/* + * Function: h5_set_info_object + * Purpose: Process environment variables setting to set up MPI Info + * object. + * Return: 0 if all is fine; otherwise non-zero. + * Programmer: Albert Cheng, 2002/05/21. + * Modifications: + * Bill Wendling, 2002/05/31 + * Modified so that the HDF5_MPI_INFO environment variable can + * be a semicolon separated list of "key=value" pairings. Most + * of the code is to remove any whitespaces which might be + * surrounding the "key=value" pairs. + */ +int +h5_set_info_object(void) +{ + char *envp; /* environment pointer */ + int ret_value=0; + + /* handle any MPI INFO hints via $HDF5_MPI_INFO */ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){ + char *next, *valp; + + valp = envp = next = HDstrdup(envp); + + if (!valp) return 0; + + /* create an INFO object if not created yet */ + if (h5_io_info_g == MPI_INFO_NULL) + MPI_Info_create(&h5_io_info_g); + + do { + size_t len; + char *key_val, *endp, *namep; + + if (*valp == ';') + valp++; + + /* copy key/value pair into temporary buffer */ + len = strcspn(valp, ";"); + next = &valp[len]; + key_val = (char *)HDcalloc(1, len + 1); + + /* increment the next pointer past the terminating semicolon */ + if (*next == ';') + ++next; + + namep = HDstrncpy(key_val, valp, len); + + /* pass up any beginning whitespaces */ + while (*namep && (*namep == ' ' || *namep == '\t')) + namep++; + + if (!*namep) continue; /* was all white space, so move to next k/v pair */ + + /* eat up any ending white spaces */ + endp = &namep[HDstrlen(namep) - 1]; + + while (endp && (*endp == ' ' || *endp == '\t')) + *endp-- = '\0'; + + /* find the '=' */ + valp = HDstrchr(namep, '='); + + if (valp != NULL) { /* it's a valid key/value pairing */ + char *tmp_val = valp + 1; + + /* change '=' to \0, move valp down one */ + *valp-- = '\0'; + + /* eat up ending whitespace on the "key" part */ + while (*valp == ' ' || *valp == '\t') + *valp-- = '\0'; + + valp = tmp_val; + + /* eat up beginning whitespace on the "value" part */ + while (*valp == ' ' || *valp == '\t') + *valp++ = '\0'; + + /* actually set the darned thing */ + if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { + HDprintf("MPI_Info_set failed\n"); + ret_value = -1; + } + } + + valp = next; + HDfree(key_val); + } while (next && *next); + + HDfree(envp); + } + + return ret_value; +} + + +/* + * Function: h5_dump_info_object + * Purpose: Display content of an MPI Info object + * Return: void + * Programmer: Albert Cheng 2002/05/21 + * Modifications: + */ +void +h5_dump_info_object(MPI_Info info) +{ + char key[MPI_MAX_INFO_KEY+1]; + char value[MPI_MAX_INFO_VAL+1]; + int flag; + int i, nkeys; + + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); + if (info==MPI_INFO_NULL){ + HDprintf("object is MPI_INFO_NULL\n"); + } + else { + MPI_Info_get_nkeys(info, &nkeys); + HDprintf("object has %d items\n", nkeys); + for (i=0; i<nkeys; i++){ + MPI_Info_get_nthkey(info, i, key); + MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag); + HDprintf("%s=%s\n", key, value); + } + + } +} +#endif /* STANDALONE */ + diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h index 83caf54..ed4b13d 100644 --- a/tools/test/perform/sio_perf.h +++ b/tools/test/perform/sio_perf.h @@ -13,12 +13,14 @@ #ifndef SIO_PERF_H__ #define SIO_PERF_H__ -#include "io_timer.h" #ifndef STANDALONE +#include "io_timer.h" #include "h5test.h" #include "h5tools.h" #include "h5tools_utils.h" #else +#undef H5_HAVE_PARALLEL +#include "io_timer.h" #include "sio_standalone.h" #endif |