summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
Diffstat (limited to 'testpar')
-rw-r--r--testpar/testphdf5.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 0f0e723..95dbf03 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -409,11 +409,20 @@ finish:
}
printf("===================================\n");
}
- MPI_Finalize();
- if (dowrite)
+
+ /* make sure all processes are finished before starting cleanup and exit */
+ MPI_Barrier(MPI_COMM_WORLD);
+ if (dowrite){
h5_cleanup(FILENAME, fapl);
- else
+ } else {
+ /* h5_cleanup would have closed fapl. Now must do it explicitedly */
H5Pclose(fapl);
+ }
+
+ /* close HDF5 library */
+ H5close();
+ /* MPI_Finalize must be called AFTER H5close which may use MPI calls */
+ MPI_Finalize();
return(nerrors);
}