summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-06-10 17:57:32 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-06-10 17:57:32 (GMT)
commitb9f2a18b5ae9adf23cac4c0336291373a25f0721 (patch)
tree0f630ce5a01721c8ac88fef5282a6f48a71c9ce8 /tools/lib
parent0f4e97907cf40af09eece68546e45cf3f3e473b2 (diff)
downloadhdf5-b9f2a18b5ae9adf23cac4c0336291373a25f0721.zip
hdf5-b9f2a18b5ae9adf23cac4c0336291373a25f0721.tar.gz
hdf5-b9f2a18b5ae9adf23cac4c0336291373a25f0721.tar.bz2
[svn-r27185] 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/lib')
-rw-r--r--tools/lib/h5tools.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 10d150f..c820aff 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)