From 16ec39276000b6e06e12dba66bce52e4dba5be04 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 6 Jan 2006 09:52:25 -0500 Subject: [svn-r11866] Purpose: bug fix 504 Description: testpar/t_mpi would hang if $HDF5_NOCLEANUP is set. E.g., % env HDF5_NOCLEANUP=yes mpirun -np 3 ./t_mpi This happened because the environment variables are not exported to all mpi processes by the mpirun command. So, some attempted to do cleanup while others don't and some hang waiting for others to act. Solution: Instead individual program checking getenv, they all just called h5_cleanup no matter. h5_cleanup now uses getenv_all to check the $HDF5_NOCLEANUP if it is in parallel mode. Platforms tested: h5committested, tested pp in heping too. --- test/h5test.c | 8 +++++++- testpar/testphdf5.c | 8 ++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index e2caea9..aeeb58f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -145,7 +145,13 @@ h5_cleanup(const char *base_name[], hid_t fapl) int retval=0; hid_t driver; - if (!HDgetenv("HDF5_NOCLEANUP")) { + if (GetTestCleanup() && +#ifdef H5_HAVE_PARALLEL + !getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP") +#else + !HDgetenv("HDF5_NOCLEANUP") +#endif + ){ for (i = 0; base_name[i]; i++) { if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) continue; diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index a07ac4a..f607d8f 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -516,12 +516,8 @@ int main(int argc, char **argv) if (MAINPROCESS && GetTestSummary()) TestSummary(); - /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) - h5_cleanup(FILENAME, fapl); - else - /* h5_cleanup would have closed fapl. Now must do it explicitedly */ - H5Pclose(fapl); + /* Clean up test files */ + h5_cleanup(FILENAME, fapl); nerrors += GetTestNumErrs(); -- cgit v0.12