summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-08-11 20:52:25 (GMT)
committerGitHub <noreply@github.com>2022-08-11 20:52:25 (GMT)
commitb745b54a09c160d9012ddac3084a5831a2c8df7c (patch)
tree26c9cefb83084183cc80a8f73770c1fd7b4943f7
parentec5100bf2675e67b292fbdd06708bb45f5a19746 (diff)
downloadhdf5-b745b54a09c160d9012ddac3084a5831a2c8df7c.zip
hdf5-b745b54a09c160d9012ddac3084a5831a2c8df7c.tar.gz
hdf5-b745b54a09c160d9012ddac3084a5831a2c8df7c.tar.bz2
Only use Subfiling VFD in tools if MPI was initialized previously (#1998)
-rw-r--r--tools/lib/h5tools.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index ca21ccd..19e946e 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -584,9 +584,17 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
#endif
}
else if (!HDstrcmp(vfd_info->u.name, drivernames[SUBFILING_VFD_IDX])) {
-#ifdef H5_HAVE_SUBFILING_VFD
- if (H5Pset_fapl_subfiling(fapl_id, (const H5FD_subfiling_config_t *)vfd_info->info) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_subfiling() failed");
+#if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_SUBFILING_VFD)
+ int mpi_initialized, mpi_finalized;
+
+ /* check if MPI is available. */
+ MPI_Initialized(&mpi_initialized);
+ MPI_Finalized(&mpi_finalized);
+
+ if (mpi_initialized && !mpi_finalized) {
+ if (H5Pset_fapl_subfiling(fapl_id, (const H5FD_subfiling_config_t *)vfd_info->info) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_subfiling() failed");
+ }
#else
H5TOOLS_GOTO_ERROR(FAIL, "The Subfiling VFD is not enabled");
#endif