MPI_Rsend_init(3)

πŸ“¦
version 5.0.1 Β· 5 versions
, in nixos 26.05, ubuntu stonking

✨ 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 in MPI_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 be MPI_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 be MPI_ANY_TAG. The largest tag value is available through the the attribute MPI_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 uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call.
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

πŸ”₯ SEE ALSO πŸ”₯

  • MPI_Start
  • MPI_Request_free
  • MPI_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