diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-05-16 13:20:02 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-05-16 13:20:02 (GMT) |
commit | 61315262a2fce90443765f4b448ad54daa28a387 (patch) | |
tree | 1781b2cd4516d1056cd4154e4d574d746255783a /perform | |
parent | 30b989f75a154f40acbccc19cd8e66723e93951d (diff) | |
download | hdf5-61315262a2fce90443765f4b448ad54daa28a387.zip hdf5-61315262a2fce90443765f4b448ad54daa28a387.tar.gz hdf5-61315262a2fce90443765f4b448ad54daa28a387.tar.bz2 |
[svn-r5424] Purpose:
feature
Description:
Added a global MPI_Info object to be used by all applicable IO API (MPI-IO
and PHDF5). Added a function to set up the info object according to
$HDF5_MPI_INFO if set.
Platforms tested:
LLNL Blue/frost
Diffstat (limited to 'perform')
-rw-r--r-- | perform/pio_engine.c | 29 | ||||
-rw-r--r-- | perform/pio_perf.c | 52 | ||||
-rw-r--r-- | perform/pio_perf.h | 1 |
3 files changed, 77 insertions, 5 deletions
diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 5b42f39..bf2d30c 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -144,6 +144,25 @@ do_pio(parameters param) /* Sanity check parameters */ + /* debug */ + if (pio_debug_level>=4) { + if (pio_info_g==MPI_INFO_NULL){ + printf("INFO object is MPI_INFO_NULL\n"); + } + else { + char value[128]; + int flag; + MPI_Info_get(pio_info_g, "IBM_largeblock_io", 127, value, &flag); + printf("after MPI_Info_get, flag=%d\n", flag); + if (flag){ + printf("found IBM_largeblock_io=%s, in info object\n", value); + }else{ + printf("could not find IBM_largeblock_io in info object\n"); + } + + } + } + /* IO type */ iot = param.io_type; @@ -929,9 +948,9 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags) case MPIO: if (flags & (PIO_CREATE | PIO_WRITE)) { - MPI_File_delete(fname, MPI_INFO_NULL); + MPI_File_delete(fname, pio_info_g); mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_CREATE | MPI_MODE_RDWR, - MPI_INFO_NULL, &fd->mpifd); + pio_info_g, &fd->mpifd); if (mrc != MPI_SUCCESS) { fprintf(stderr, "MPI File Open failed(%s)\n", fname); @@ -948,7 +967,7 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags) } } else { mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, - MPI_INFO_NULL, &fd->mpifd); + pio_info_g, &fd->mpifd); if (mrc != MPI_SUCCESS) { fprintf(stderr, "MPI File Open failed(%s)\n", fname); @@ -966,7 +985,7 @@ do_fopen(iotype iot, char *fname, file_descr *fd /*out*/, int flags) GOTOERROR(FAIL); } - hrc = H5Pset_fapl_mpio(acc_tpl, pio_comm_g, MPI_INFO_NULL); + hrc = H5Pset_fapl_mpio(acc_tpl, pio_comm_g, pio_info_g); if (hrc < 0) { fprintf(stderr, "HDF5 Property List Set failed\n"); @@ -1078,7 +1097,7 @@ do_cleanupfile(iotype iot, char *fname) break; case MPIO: case PHDF5: - MPI_File_delete(fname, MPI_INFO_NULL); + MPI_File_delete(fname, pio_info_g); break; } } diff --git a/perform/pio_perf.c b/perform/pio_perf.c index f9cac10..cdcf664 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -82,6 +82,7 @@ FILE *output; /* output file */ int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */ +MPI_Info pio_info_g=MPI_INFO_NULL;/* MPI INFO object to run the PIO */ MPI_Comm pio_comm_g; /* Communicator to run the PIO */ int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ int pio_mpi_nprocs_g; /* Number of processes of pio_comm_g */ @@ -233,6 +234,7 @@ static int destroy_comm_world(void); static void output_report(const char *fmt, ...); static void print_indent(register int indent); static void usage(const char *prog); +static int parse_environment(void); /* * Function: main @@ -282,6 +284,7 @@ main(int argc, char **argv) pio_comm_g = MPI_COMM_WORLD; + parse_environment(); opts = parse_command_line(argc, argv); if (!opts) { @@ -1041,6 +1044,55 @@ usage(const char *prog) } } +/* + * Function: parse_environment + * Purpose: Process all environment variables setting. + * Return: 0 if all is fine; otherwise non-zero. + * Programmer: Albert Cheng, 15 May 2002. + * Modifications: + */ +static int +parse_environment(void) +{ + char *envp; /* environment pointer */ + char *envendp; /* end of environment string */ + char *namep, *valp; /* name, value pointers */ + int mpi_err; + int ret_value=0; + + /* handle any MPI INFO hints via $HDF5_MPI_INFO */ + if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + envp = HDstrdup(envp); + envendp = HDstrchr(envp, NULL); /* remember end of string */ + + /* create an INFO object if not created yet */ + if (pio_info_g==MPI_INFO_NULL) + MPI_Info_create (&pio_info_g); + + /* parse only one setting. Need to extend it to handle multiple */ + /* settings. LATER */ + namep=envp; + valp=HDstrchr(namep, '='); + if (valp != NULL){ + /* change '=' to NULL, move valp down one */ + *valp++ = NULL; + if (MPI_SUCCESS!=MPI_Info_set(pio_info_g, namep, valp)){ + printf("MPI_Info_set failed\n"); + ret_value = -1; + }else{ + if (pio_debug_level>=4){ + printf("MPI_Info_set with %s=%s.\N", namep, valp); + } + } + + } + } + + if (envp) + HDfree(envp); + return(ret_value); +} + #else /* H5_HAVE_PARALLEL */ /* diff --git a/perform/pio_perf.h b/perform/pio_perf.h index d14c419..bea92f4 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -44,6 +44,7 @@ extern FILE *output; /* output file */ extern pio_time *timer_g; /* timer: global for stub functions */ extern int comm_world_rank_g; /* my rank in MPI_COMM_RANK */ extern int comm_world_nprocs_g;/* num. of processes of MPI_COMM_WORLD */ +extern MPI_Info pio_info_g; /* MPI INFO object to run the PIO */ extern MPI_Comm pio_comm_g; /* Communicator to run the PIO */ extern int pio_mpi_rank_g; /* MPI rank of pio_comm_g */ extern int pio_mpi_nprocs_g; /* number of processes of pio_comm_g */ |