Search code examples
mpidistributed-computing

Difference between MPI_Barrier and MPI_Waitall when using MPI?


Hi all I am really new to OpenMPI and I have just started to play with it. I was wondering what's the difference between MPI_Barrier and MPI_Waitall since both of them require that all the operations are finished before continuing with the code. Thank you!


Solution

  • Barrier waits until all processes have reached a particular point in your program (that is, until all processes have called Barrier the same number of times). It doesn't necessarily wait for any other requests to complete.

    Waitall waits until all the nonblocking requests you specify have completed. It doesn't necessarily wait for other processes.

    If you happen to need to wait for both, then you could do a Waitall first, then a Barrier.