I have a master-slave model in my MPI program. I want to make slaves wait for each other before going to the next iteration.
if (rank == 0) {
// master process
} else {
// slave process
for (int i = 0; i < 10; i++) {
// do stuff
// wait for all slaves to end iteration i
}
}
Basically, I don't want any processor to go into next iteration without all other slaves complete their current iteration. How can I do this? With MPI_Barrier
?