diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-06-11 19:08:49 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-06-11 19:08:49 (GMT) |
commit | 3e3f88cfa4a04d94288d0ef7904500b1ef966333 (patch) | |
tree | be73c0ca26a7ffc252fc5da4283aabd992229678 /tools | |
parent | 849555ef99170b02151eb72cf14d0ce7e0cc5a22 (diff) | |
download | hdf5-3e3f88cfa4a04d94288d0ef7904500b1ef966333.zip hdf5-3e3f88cfa4a04d94288d0ef7904500b1ef966333.tar.gz hdf5-3e3f88cfa4a04d94288d0ef7904500b1ef966333.tar.bz2 |
[svn-r27190] merge 27185 from trunk:
- fix more instances where both mpi is_initialized and is_finalized need to be checked before making any MPI calls.
tested with h5committest.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5tools.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a7b0e5e..1284924 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -54,9 +54,6 @@ unsigned long long packed_data_mask; /* mask in which packed bits to display */ /* module-scoped variables */ static int h5tools_init_g; /* if h5tools lib has been initialized */ -#ifdef H5_HAVE_PARALLEL -static int h5tools_mpi_init_g; /* if MPI_Init() has been called */ -#endif /* H5_HAVE_PARALLEL */ /* Names of VFDs */ static const char *drivernames[]={ @@ -516,11 +513,14 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) } #ifdef H5_HAVE_PARALLEL else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) { + int mpi_initialized, mpi_finalized; + /* MPI-I/O Driver */ - /* check if MPI has been initialized. */ - if(!h5tools_mpi_init_g) - MPI_Initialized(&h5tools_mpi_init_g); - if(h5tools_mpi_init_g) { + /* check if MPI is available. */ + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if(mpi_initialized && !mpi_finalized) { if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) goto error; if(drivernum) |