MPI_Barrier not working inside a loop
问题 I have running some tests on the MPI functions to understand how it works and have got a weird result with the MPI_Barrier: it does what everyone would expect if I use it in code like int main(int argc, char *argv[]) { <some code> MPI_Barrier(MPI_COMM_WORLD); <more code> MPI_Barrier(MPI_COMM_WORLD); <...> } but when I call it from inside a loop i get random results. To be specific, I have the following test code: #include "mpi.h" #include <stdio.h> int main(int argc, char *argv[]) { int i, rb