mpi-persistent-communication
Table of Contents
MPI Persistent communication
Persistent communication registers a pattern once with MPI_Send_init and MPI_Recv_init, then reuses it with MPI_Start/MPI_Wait. Amortises setup cost for repeated communication.
MPI_Request reqs[2]; MPI_Send_init(send_buf, N, MPI_DOUBLE, right, 0, MPI_COMM_WORLD, &reqs[0]); MPI_Recv_init(recv_buf, N, MPI_DOUBLE, left, 0, MPI_COMM_WORLD, &reqs[1]); for (int iter = 0; iter < MAX_ITER; iter++) { pack_halo(send_buf); MPI_Startall(2, reqs); compute_interior(); MPI_Waitall(2, reqs, MPI_STATUSES_IGNORE); use_halo(recv_buf); } MPI_Request_free(&reqs[0]); MPI_Request_free(&reqs[1]);
The implementation can cache internal state and skip repeated argument validation, which reduces per-iteration overhead for small messages. On high-latency networks the benefit is modest since latency dominates; for many small messages in a tight loop it adds up. Persistent requests follow the same non-blocking semantics as MPI_Isend/MPI_Irecv: the buffer must not be modified between MPI_Start and MPI_Wait.
mpi-persistent-communication.md · Last modified: by 127.0.0.1
