diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-06-08 20:52:48 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-06-08 20:52:48 (GMT) |
commit | 929e8ce1281a2a4953f6f3925a8595227fcb8f7f (patch) | |
tree | 5a6e2ad3622dadf6de58ce81397328e527fbd1c7 /src/H5.c | |
parent | 02e9a43900cb8d2879b9bb2af9c3a9aba98c8949 (diff) | |
download | hdf5-929e8ce1281a2a4953f6f3925a8595227fcb8f7f.zip hdf5-929e8ce1281a2a4953f6f3925a8595227fcb8f7f.tar.gz hdf5-929e8ce1281a2a4953f6f3925a8595227fcb8f7f.tar.bz2 |
[svn-r27162] fix for HDFFV-9412:
- Check for mpi is_initialized and is_finalized before making MPI calls in init/terminate of HDF5.
- Add a test to make sure we can make serial HDF5 calls from rank 0 after MPI_Finalize is called.
tested with h5committest
Diffstat (limited to 'src/H5.c')
-rw-r--r-- | src/H5.c | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -115,26 +115,27 @@ H5_init_library(void) #ifdef H5_HAVE_PARALLEL { int mpi_initialized; + int mpi_finalized; int mpi_code; MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); #ifdef H5_HAVE_MPE /* Initialize MPE instrumentation library. */ - if (!H5_MPEinit_g) - { - int mpe_code; - if (mpi_initialized){ - mpe_code = MPE_Init_log(); - HDassert(mpe_code >=0); - H5_MPEinit_g = TRUE; - } + if (!H5_MPEinit_g) { + int mpe_code; + if (mpi_initialized && !mpi_finalized) { + mpe_code = MPE_Init_log(); + HDassert(mpe_code >=0); + H5_MPEinit_g = TRUE; } + } #endif /*H5_HAVE_MPE*/ /* add an attribute on MPI_COMM_SELF to call H5_term_library when it is destroyed, i.e. on MPI_Finalize */ - if (mpi_initialized) { + if (mpi_initialized && !mpi_finalized) { int key_val; if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN, @@ -334,11 +335,14 @@ H5_term_library(void) * down if any of the below code involves using the instrumentation code. */ if(H5_MPEinit_g) { - int mpe_code; int mpi_initialized; + int mpi_finalized; + int mpe_code; MPI_Initialized(&mpi_initialized); - if(mpi_initialized) { + MPI_Finalized(&mpi_finalized); + + if (mpi_initialized && !mpi_finalized) { mpe_code = MPE_Finish_log("h5log"); HDassert(mpe_code >=0); } /* end if */ |