Commit 35eaa463 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Add a synchronization point at the end of engine_dump_restarts() to make sure...

Add a synchronization point at the end of engine_dump_restarts() to make sure everything has been written before proceeding and risking a crash
parent d7be64e0
...@@ -2651,6 +2651,13 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) { ...@@ -2651,6 +2651,13 @@ void engine_dump_restarts(struct engine *e, int drifted_all, int force) {
if (!drifted_all) engine_drift_all(e, /*drift_mpole=*/1); if (!drifted_all) engine_drift_all(e, /*drift_mpole=*/1);
restart_write(e, e->restart_file); restart_write(e, e->restart_file);
#ifdef WITH_MPI
/* Make sure all ranks finished writing to avoid having incomplete
* sets of restart files should the code crash before all the ranks
* are done */
MPI_Barrier(MPI_COMM_WORLD);
#endif
if (e->verbose) if (e->verbose)
message("Dumping restart files took %.3f %s", message("Dumping restart files took %.3f %s",
clocks_from_ticks(getticks() - tic), clocks_getunit()); clocks_from_ticks(getticks() - tic), clocks_getunit());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment