aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
diff options
context:
space:
mode:
authorThomas Radke <tradke@aei.mpg.de>2005-07-25 15:05:00 +0000
committerThomas Radke <tradke@aei.mpg.de>2005-07-25 15:05:00 +0000
commit3addd8670876e3952e52f90590214edac2071fe4 (patch)
treeed510ba3812aa2de0d499a468aae9615d4953afe /Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
parentcecfc17a96fe8e187e4a3fbeba455287712c6483 (diff)
CarpetIOHDF5: remove an old checkpoint only if the current one has been written successfully by all output processors
darcs-hash:20050725150549-776a0-fe03ace195af6a723af91ca7d0a63eaeae25b050.gz
Diffstat (limited to 'Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc')
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
index 47757df5a..b501bcf12 100644
--- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
+++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc
@@ -804,14 +804,18 @@ static int Checkpoint (const cGH* const cctkGH, int called_from)
HDF5_ERROR (H5Fclose(file));
}
- if (retval == 0 and file >= 0) {
- if (rename (tempname, filename)) {
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Could not rename temporary checkpoint file '%s' to '%s'",
- tempname, filename);
- retval = -1;
- } else {
- if (checkpoint_keep > 0) {
+ // get global error count
+ int temp = retval;
+ MPI_Allreduce (&temp, &retval, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+
+ if (retval == 0) {
+ if (file >= 0) {
+ if (rename (tempname, filename)) {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Could not rename temporary checkpoint file '%s' to '%s'",
+ tempname, filename);
+ retval = -1;
+ } else if (checkpoint_keep > 0) {
CarpetIOHDF5GH *myGH =
(CarpetIOHDF5GH *) CCTK_GHExtension (cctkGH, CCTK_THORNSTRING);
@@ -836,6 +840,10 @@ static int Checkpoint (const cGH* const cctkGH, int called_from)
}
}
}
+ } else {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Failed to create checkpoint at iteration %d",
+ cctkGH->cctk_iteration);
}
// save the iteration number of this checkpoint