MPI Barrier
Barrier (Synchronisation)
We may use syncrnonisation for the following reasons:
- Debugging:
- We can test communication speed (not load imbalance) by using a barrier before a gather.
- Ensure various task have been completed before continuing:
- We could also test for completion in a loop while running other non-dependant tasks.
- Reducing side-effects for time sensitive code.
- Enforce ordering.
Barrier Syntax
C Syntax
#include <mpi.h>
int MPI_Barrier(MPI_Comm comm)
We should be careful when using barrier as it can significantly slow down code.