MPI_Rsend_init(3)
β¨ MPI_Rsend_init(3) β¨ β aka the MPI bestie page π
okay so bestie, welcome to MPI_Rsend_init(3) from the MPI manual, section 3 π¦ sit down, grab a snack, we're gonna make a persistent request for a ready send and it's gonna be iconic.
πΈ NAME πΈ
MPI_Rsend_init β Creates a persistent request for a ready send π
like, it doesn't send yet. it just sets up the vibe for a send you'll fire off later, over and over, with zero extra drama. main character energy fr fr β¨
π SYNOPSIS π
int MPI_Rsend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Rsend_init_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, MPI_Request *request)
two versions, no cap β the classic one and the _c one that takes an MPI_Count for count when your numbers are β¨bigβ¨.
π INPUT PARAMETERS π
bufβ initial address of send buffer (choice). lowkey where your data lives, bestie.countβ number of elements sent (non-negative integer). must be>= 0, we do not do negativity here πdatatypeβ type of each element (handle)destβ rank of destination (integer). who's getting the message πtagβ message tag (integer). your little label so the receiver knows what's what π·οΈcommβ communicator (handle). the friend group this whole thing happens in π«Ά
π OUTPUT PARAMETERS π
requestβ communication request (handle). this is the persistent request you just birthed, hold onto it, it's precious β¨
π§΅ THREAD AND INTERRUPT SAFETY π§΅
This routine is thread-safe. what that means: multiple threads can use it at the same time and you do not need to bring your own thread locks. no extra gatekeeping required π
BUT. and this is the important but β it is not interrupt safe. not interrupt safe, bestie π typically this is because it uses 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. periodt.
π NOTES FOR FORTRAN π
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an extra argument ierr 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. iykyk π
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. yes, all of them. that's just the vibe over there π
π ERRORS π
okay so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines as the value of the function, Fortran routines in the last argument. before that value comes back, the current MPI error handler gets called. by default, this error handler aborts the MPI job π³ (yes, it kills the whole thing, dramatic but true).
You can change the error handler 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, don't, bestie π. The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. soβ¦ maybe fine, maybe not. vibe check at your own risk π«Ά
here's the full error roster, no skips:
MPI_SUCCESSβ No error; MPI routine completed successfully. slay βMPI_ERR_ARGβ Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid.MPI_ERR_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank).MPI_ERR_COUNTβ Invalid count argument. Count arguments must be non-negative; a count of zero is often valid.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 the attributeMPI_TAG_UB. (yes the "the the" is canon, we keep the lore π)MPI_ERR_TYPEβ Invalid datatype argument. Additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code.
π₯ SEE ALSO π₯
MPI_StartMPI_Request_freeMPI_Send_init
go read those too, bestie, they're all part of the same storyline π
that's the whole page, and it's giving absolutely everything π
this edition was served fresh on 4/10/2026, straight from the MPI manual β mwah, MPI_Rsend_init(3) out πβ¨
π¦ 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