mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-05 15:42:32 +08:00
Fix standalone compile issues
This commit is contained in:
parent
99fa2dbec3
commit
9b82f8c0ac
@ -138,43 +138,43 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop)
|
|||||||
switch(pt->type){
|
switch(pt->type){
|
||||||
#ifdef H5_HAVE_PARALLEL
|
#ifdef H5_HAVE_PARALLEL
|
||||||
case MPI_CLOCK:
|
case MPI_CLOCK:
|
||||||
if (start_stop == TSTART) {
|
if (start_stop == TSTART) {
|
||||||
pt->mpi_timer[t] = MPI_Wtime();
|
pt->mpi_timer[t] = MPI_Wtime();
|
||||||
|
|
||||||
/* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_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 */
|
* we compute the time it took to only open the file */
|
||||||
if(t == HDF5_FINE_WRITE_FIXED_DIMS)
|
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];
|
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)
|
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];
|
pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
|
pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
|
||||||
pt->mpi_timer[t] = MPI_Wtime();
|
pt->mpi_timer[t] = MPI_Wtime();
|
||||||
|
|
||||||
/* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_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 */
|
* we compute the time it took to close the file after the last read/write finished */
|
||||||
if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
|
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];
|
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)
|
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->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
case MPI_CLOCK:
|
case MPI_CLOCK:
|
||||||
HDfprintf(stderr, "MPI clock set in serial library\n");
|
HDfprintf(stderr, "MPI clock set in serial library\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif /* H5_HAVE_PARALLEL */
|
#endif /* H5_HAVE_PARALLEL */
|
||||||
case SYS_CLOCK:
|
case SYS_CLOCK:
|
||||||
if (start_stop == TSTART) {
|
if (start_stop == TSTART) {
|
||||||
HDgettimeofday(&pt->sys_timer[t], NULL);
|
HDgettimeofday(&pt->sys_timer[t], NULL);
|
||||||
|
|
||||||
/* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_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 */
|
* we compute the time it took to only open the file */
|
||||||
if(t == HDF5_FINE_WRITE_FIXED_DIMS)
|
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]));
|
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)
|
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]));
|
pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS]));
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -183,19 +183,19 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop)
|
|||||||
HDgettimeofday(&sys_t, NULL);
|
HDgettimeofday(&sys_t, NULL);
|
||||||
pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t]));
|
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
|
/* 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 */
|
* we compute the time it took to close the file after the last read/write finished */
|
||||||
if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
|
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]));
|
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)
|
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]));
|
pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS]));
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
|
HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
|
||||||
return NULL;
|
return NULL;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -221,10 +221,3 @@ io_time_get(io_time_t *pt, timer_type t)
|
|||||||
|
|
||||||
return pt->total_time[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
|
|
||||||
|
@ -13,12 +13,13 @@
|
|||||||
#ifndef PIO_PERF_H__
|
#ifndef PIO_PERF_H__
|
||||||
#define PIO_PERF_H__
|
#define PIO_PERF_H__
|
||||||
|
|
||||||
#include "io_timer.h"
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
|
#include "io_timer.h"
|
||||||
#include "h5test.h"
|
#include "h5test.h"
|
||||||
#include "h5tools.h"
|
#include "h5tools.h"
|
||||||
#include "h5tools_utils.h"
|
#include "h5tools_utils.h"
|
||||||
#else
|
#else
|
||||||
|
#include "io_timer.h"
|
||||||
#include "pio_standalone.h"
|
#include "pio_standalone.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -164,3 +164,135 @@ print_version(const char *progname)
|
|||||||
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
||||||
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
|
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 */
|
||||||
|
|
||||||
|
@ -13,12 +13,14 @@
|
|||||||
#ifndef SIO_PERF_H__
|
#ifndef SIO_PERF_H__
|
||||||
#define SIO_PERF_H__
|
#define SIO_PERF_H__
|
||||||
|
|
||||||
#include "io_timer.h"
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
|
#include "io_timer.h"
|
||||||
#include "h5test.h"
|
#include "h5test.h"
|
||||||
#include "h5tools.h"
|
#include "h5tools.h"
|
||||||
#include "h5tools_utils.h"
|
#include "h5tools_utils.h"
|
||||||
#else
|
#else
|
||||||
|
#undef H5_HAVE_PARALLEL
|
||||||
|
#include "io_timer.h"
|
||||||
#include "sio_standalone.h"
|
#include "sio_standalone.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user