My question is pretty simple, when I write:
//Compile with: mpicc temp.c
//Run with: mpirun -n 4 ./a.out
#include <mpi.h>
#include <stdio.h>
int main(int argc, char **argv){
MPI_Init(&argc,&argv);
int nbr, rank;
MPI_Comm_size(MPI_COMM_WORLD, &nbr);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("%d before\n",rank);
MPI_Barrier(MPI_COMM_WORLD);
printf("%d after\n",rank);
MPI_Finalize();
}
with 4 processes, I get:
3 before
3 after
2 before
2 after
1 before
1 after
0 before
0 after
Why isn't it all the "before" then all the "after" ? I really need that behavior. Thanks for your help !