Site Tools


mpi-blocking

Table of Contents

MPI Blocking and non-blocking

Blocking and non-blocking communication in MPI: MPI_Send and MPI_Recv block until complete. MPI_Isend and MPI_Irecv return immediately with a request handle; MPI_Wait blocks later.

MPI_Request req;
int x = 42;
MPI_Isend(&x, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, &req);
do_other_work();            // overlap computation with communication
MPI_Wait(&req, MPI_STATUS_IGNORE);  // x must not change before this point

MPI_Test checks whether a request is complete without blocking, returning a flag. MPI_Waitall and MPI_Testall handle arrays of requests, which is common when a process has posted non-blocking sends to multiple neighbors. Non-blocking communication is the primary tool for hiding communication latency behind useful computation.

mpi-blocking.md · Last modified: by 127.0.0.1