MPI_Isendrecv(3)
π NAME π
MPI_Isendrecv β starts a nonblocking send and a receive, together, in one call. bestie it's giving "two errands, one trip" energy ποΈβ¨
β¨ SYNOPSIS β¨
int MPI_Isendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
int dest, int sendtag, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm,
MPI_Request *request)
int MPI_Isendrecv_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf,
MPI_Count recvcount, MPI_Datatype recvtype, int source,
int recvtag, MPI_Comm comm, MPI_Request *request)
so yes there's a baby version and a big-girl version π
the _c one takes MPI_Count for the counts, everything else is the same vibe.
This page lives in the MPI manual, section 3 β iykyk π«Ά
πΈ INPUT PARAMETERS πΈ
sendbufβ the initial address of the send buffer (a choice)sendcountβ how many elements are in the send buffer (non-negative integer, no negatives pls)sendtypeβ the datatype of each element in the send buffer (a handle)destβ rank of the destination (integer) β who's getting the goods π¬sendtagβ the send tag (integer)recvcountβ how many elements are in the receive buffer (non-negative integer)recvtypeβ the datatype of each element in the receive buffer (a handle)sourceβ rank of the source, orMPI_ANY_SOURCE(integer) β not me accepting mail from literally anyone πrecvtagβ the receive tag, orMPI_ANY_TAG(integer)commβ the communicator (a handle)
π OUTPUT PARAMETERS π
recvbufβ the initial address of the receive buffer (a choice)requestβ the communication request (a handle) β hold onto this one, she's the main character for your laterMPI_Wait/MPI_Testera π
π¦ THREAD AND INTERRUPT SAFETY π¦
This routine is thread-safe. That means multiple threads can use it at the same time and you do not need to bring your own thread locks β she handles herself, no cap. πͺ
However (and this is the plot twist π): the routine is not interrupt safe. Typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines, that are themselves not interrupt-safe. So likeβ¦ thread-safe yes, interrupt-safe no. Different things, bestie, don't mix them up.
π§ NOTES FOR FORTRAN π§
Every MPI routine in Fortran (except MPI_WTIME and MPI_WTICK) gets an extra argument called ierr tacked onto the very end of the argument list. ierr is an integer and it means exactly the same thing as the return value of the routine in C. In Fortran, MPI routines are subroutines, and you invoke them with the call statement. π
And all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just how Fortran rolls π
π₯ ERRORS π₯
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines hand it back as the value of the function, Fortran routines put it in that last argument. Before the value comes back to you, the current MPI error handler gets called. By default, that error handler aborts the MPI job. Like, whole thing, gone. π
You can swap the error handler out with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). The MPI-1 routine MPI_Errhandler_set may be used, but its use is deprecated β so like, she's retired, respect the retirement. π
The predefined error handler MPI_ERRORS_RETURN may be used to make error values get returned instead. And heads up: MPI does not guarantee that an MPI program can continue past an error β though MPI implementations will attempt to continue whenever possible. Fingers crossed energy. π€
MPI_SUCCESSβ no error, the routine completed successfully. slay. β¨MPI_ERR_ARGβ invalid argument. Something in there is invalid and it's not identified by a more specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ invalid buffer pointer. Usually that's a null buffer where a null one is not valid. π«MPI_ERR_COMMβ invalid communicator. A super common one is passing a null communicator into a call β which isn't even allowed inMPI_Comm_rank.MPI_ERR_COUNTβ invalid count argument. Counts must be non-negative; a count of zero is often valid though, so don't panic about a0.MPI_ERR_RANKβ invalid source or destination rank. Ranks must be between zero and the size of the communicator minus one; ranks in a receive (MPI_Recv,MPI_Irecv,MPI_Sendrecv, etc.) may also beMPI_ANY_SOURCE.MPI_ERR_TAGβ invalid tag argument. Tags must be non-negative; tags in a receive (MPI_Recv,MPI_Irecv,MPI_Sendrecv, etc.) may also beMPI_ANY_TAG. The largest tag value is available through the attributeMPI_TAG_UB.MPI_ERR_TYPEβ invalid datatype argument. Also, this error can pop up if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. commit your types, girl π€MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more info about this error code.
okay that's the whole page, you're so welcome π«Ά this was the MPI_Isendrecv(3) manual page from the MPI manual, dated 4/10/2026 β go forth and sendrecv nonblockingly, bestie, ily ππΈβ¨
π¦ where this page comes from
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms