mpi Barrier


The MPI_Barrier operation performs a synchronization among the processes belonging to the given communicator. That is, all the processes from a given communicator will wait within the MPI_Barrier until all of them are inside, and at that point, they will leave the operation.

int res;

res = MPI_Barrier (MPI_COMM_WORLD); /* all processes will wait */
if (res != MPI_SUCCESS)
    fprintf (stderr, "MPI_Barrier failed\n");
    exit (0);