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
Branches
Tags
No related merge requests found
......@@ -197,8 +197,10 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
* one-by-one. */
int kk = k;
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. */
fd = fopen(dumpfile, "a");
......@@ -223,6 +225,9 @@ void mpiuse_dump_logs(int nranks, const char *dumpfile) {
}
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