Commit 1529b22a authored by Sonja Happ's avatar Sonja Happ

add barriers in forward and backward sweeps

parent b3492586
......@@ -191,6 +191,9 @@ void Model::do_backward_sweep() {
}
}
} // check finished
// this barrier is required to make all processes know the
// result of the finished check before entering a new loop iteration
MPI_Barrier(MPI_COMM_WORLD);
IO->log_info("Backward sweep finished: " + std::to_string(backward_sweep_finished));
IO->stop_time_measurement(IO->tm_bcast_backward_sweep);
......@@ -301,12 +304,17 @@ void Model::do_forward_sweep() {
for(int i=0; i<=highest_filled_rank; i++){
if (i != rank) {
IO->log_info("Waiting for Irecv of rank " + std::to_string(i));
MPI_Wait(&forward_req[i], &status);
}
}
}
}
} // finished check
// This barrier is required to make sure that all processes
// know about the finished state before entering the next loop iteration
MPI_Barrier(MPI_COMM_WORLD);
IO->stop_time_measurement(IO->tm_bcast_forward_sweep);
// in forward sweep info about next and previous electrical nodes are required
......@@ -332,4 +340,4 @@ void Model::do_forward_sweep() {
IO->add_to_forward_loop_counter(counter);
IO->log_info("forward sweep took " + std::to_string(counter) + " iterations.");
IO->stop_time_measurement(IO->tm_forward_sweep);
}
\ No newline at end of file
}
Markdown is supported
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