MPI_Irsend(3)
π MPI_Irsend(3) β the MPI manual page
okay so bestie, we're in the MPI manual, and today's main character is MPI_Irsend π
β¨
β¨ NAME β¨
MPI_Irsend β starts a nonblocking ready send πβοΈπ¨
πΈ SYNOPSIS πΈ
int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Irsend_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, MPI_Request *request)
π INPUT PARAMETERS π
bufβ the initial address of the send buffer (choice). this is where your lil data lives πcountβ number of elements in the send buffer (non-negative integer). no negativity allowed babes, that's the vibe check π«datatypeβ datatype of each send buffer element (handle). tells MPI what kind of lil guys you're shipping π¦destβ rank of destination (integer). who's getting this π«Άtagβ message tag (integer). your lil label so the receiver knows what's up π·οΈcommβ communicator (handle). the group chat, basically π£οΈ
π OUTPUT PARAMETERS π
requestβ communication request (handle). hold onto this one, it's your receipt π§Ύβ¨
π§΅ THREAD AND INTERRUPT SAFETY π§΅
this routine is thread-safe, periodt. what that means: multiple threads can use it at the same time and you don't have to bring your own thread locks. no cap π
but β and this is the part where I need you to listen β it 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, the routine is chill in threads but don't go interrupting it, ok? π
π NOTES FOR FORTRAN π
all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK, they're the rebels π) have an extra argument called ierr sitting at the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine in C.
in Fortran, MPI routines are subroutines, so you invoke them with the call statement. very retro, very cute π
and also: all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. iconic behavior honestly π
π ERRORS π
all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines as the value of the function, and Fortran routines in the last argument. before that 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.
the error handler can be swapped out withMPI_Comm_set_errhandler(for communicators),MPI_File_set_errhandler(for files), andMPI_Win_set_errhandler(for RMA windows). the MPI-1 routineMPI_Errhandler_setalso exists but its use is deprecated β οΈ. you can also use the predefined error handlerMPI_ERRORS_RETURNto make error values get returned instead of nuking everything. note that MPI does not guarantee an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. so likeβ¦ good luck but no promises π€·ββοΈ
here's the lineup of error codes, bestie:
MPI_SUCCESSβ no error; the MPI routine completed successfully πMPI_ERR_ARGβ invalid argument. some argument is invalid and it's not identified by a specific error class (e.g.,MPI_ERR_RANK). vague, i know πMPI_ERR_BUFFERβ invalid buffer pointer. usually a null buffer where one is not valid. bestie. the buffer. it's null π«MPI_ERR_COMMβ invalid communicator. a common oopsie is using a null communicator in a call (not even allowed inMPI_Comm_rank). not even there!! π€MPI_ERR_COUNTβ invalid count argument. count arguments must be non-negative; a count of zero is often valid. zero is fine, negative is not β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. use it, don't guess πMPI_ERR_TYPEβ invalid datatype argument. also, this error can happen if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. commit your types first, babe π«ΆMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the catch-all, the mystery box π¦β
that's the whole page babe, you ate it, no crumbs πβ¨
source: the MPI manual, dated 4/10/2026 β and yes it's literally titled MPI_Irsend(3) in the footer too. mwah π bye bestie, go send something ready π¦π
π¦ 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