Nonblocking Communication Syntax
The nonblocking calls have the same syntax as the blocking ones, with two exceptions:
-
The letter "
I
" (think of "initiate") appears in the name of the call, immediately following the first underscore: e.g.,MPI_Irecv
. - The final argument is a handle to an opaque (or hidden) request object that holds detailed information about the transaction. The request handle can be used for subsequent Wait and Test calls.
For example, a standard nonblocking send and its corresponding wait look like this:
C:
int MPI_Isend (const void *buf, int count, \
MPI_Datatype datatype, int dest, int tag, \
MPI_Comm comm, MPI_Request *request)
int MPI_Wait (MPI_Request *request, MPI_Status *status)
Fortran:
MPI_ISEND(buf, count, dtype, dest, tag, comm, request, ierror)
MPI_WAIT(request, status, ierror)
MPI_IRecv looks much the same:
int MPI_Irecv (void* buf, int count, MPI_Datatype datatype, \
int source, int tag, MPI_Comm comm, MPI_Request *request)
MPI_IRECV(buf, count, dtype, source, tag, comm, request, &
ierror)
The communication mode is still relevant for nonblocking calls and is still selected via the name of the send routine, though the precise behind-the-scenes behavior can differ to some degree from the equivalent blocking call. In any case, you can choose from among a variety of nonblocking send functions, including Synchronous (MPI_Issend), Ready (MPI_Irsend), and Buffered (MPI_Ibsend), as well as the standard send (MPI_Isend).