Skip to content
Snippets Groups Projects
Commit 510bbef9 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Forgot bcast is not synchronous, so we need a barrier to stop loops running ahead

parent f5c55154
No related branches found
No related tags found
No related merge requests found
...@@ -197,8 +197,10 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { ...@@ -197,8 +197,10 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
* one-by-one. */ * one-by-one. */
int kk = k; int kk = k;
MPI_Bcast(&kk, 1, MPI_INT, 0, MPI_COMM_WORLD); MPI_Bcast(&kk, 1, MPI_INT, 0, MPI_COMM_WORLD);
message("Bcast says: %d/%d/%d", kk, k, myrank);
if (k == myrank) { if (kk == myrank) {
message("Dumping from rank: %d/%d/%d", kk, k, myrank);
/* Open file and position at end. */ /* Open file and position at end. */
fd = fopen(dumpfile, "a"); fd = fopen(dumpfile, "a");
...@@ -223,6 +225,9 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) { ...@@ -223,6 +225,9 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
} }
fclose(fd); fclose(fd);
} }
/* Need to stay in step. */
MPI_Barrier(MPI_COMM_WORLD);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment