MPI_Rsend(3)

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

πŸ’– MPI_Rsend β€” blocking ready send πŸ’–

okay bestie, welcome to the MPI manual page for MPI_Rsend. yes that's the section, three whole pages of collective-communication goodness, and we're gonna read it together like it's a group chat at 2am. grab a snack. πŸ“


✨ NAME ✨

MPI_Rsend β€” Blocking ready send. that's it, that's the whole name. she's blocking, she's ready, and she sends. πŸ‘‘


🌸 SYNOPSIS 🌸

int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm)

int MPI_Rsend_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)

two flavors, both iconic. the _c one is for when your count is a big ol' MPI_Count instead of a regular int. slay. πŸ’…


πŸ¦‹ INPUT PARAMETERS πŸ¦‹

the whole friend group, one by one:

  • buf β€” initial address of send buffer (choice). this is where your stuff lives, bestie. πŸŽ€
  • count β€” number of elements in send buffer (non-negative integer). not negative. i'm serious. πŸ™ˆ
  • datatype β€” datatype of each send buffer element (handle). it's giving "what even are these elements". 🌈
  • dest β€” rank of destination (integer). who's getting the message. πŸ’Œ
  • tag β€” message tag (integer). the lil label so your receiver knows what's up. 🏷️
  • comm β€” communicator (handle). the friend group they're both in. 🫢

πŸ’€ THREAD AND INTERRUPT SAFETY πŸ’€

ok so: this routine is thread-safe. which means multiple threads can use it at the same time with zero user-provided thread locks needed. no cap. it just works. ✨

BUT. and this is the important but β€” it's not interrupt safe. typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines that themselves aren't interrupt-safe. so like, thread-safe: yes. interrupt-safe: absolutely not, bestie. 😭


🧚 NOTES FOR FORTRAN 🧚

for the Fortran girlies (affectionate) πŸ‘‘:

  • every MPI routine in Fortran has an extra argument called ierr at the end of the argument list β€” the only exceptions are MPI_WTIME and MPI_WTICK. 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. periodt.
  • all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, even the fancy ones. πŸŽ€

πŸ”₯ ERRORS πŸ”₯

every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines hand it back as the function's value, and Fortran routines put it in that last argument. before the value even comes back, the current MPI error handler gets called. by default? that handler aborts the MPI job. like, whole thing, gone, bye. πŸ’€

you can swap the error handler out with:

  • MPI_Comm_set_errhandler β€” for communicators
  • MPI_File_set_errhandler β€” for files
  • 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, fr fr). and if you want error values returned instead of the job dying, use the predefined error handler MPI_ERRORS_RETURN. 🌈

heads up though: MPI does not guarantee that an MPI program can continue past an error. however, implementations will attempt to continue whenever possible. so like, they'll try. no promises. 🫢

here's the whole roster of error codes:

  • MPI_SUCCESS β€” no error, MPI routine completed successfully. the dream. ✨
  • MPI_ERR_BUFFER β€” invalid buffer pointer. usually a null buffer where one is not valid. bestie why is it null. 😭
  • MPI_ERR_COMM β€” invalid communicator. a common error is using 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 attribute MPI_TAG_UB. 🏷️
  • 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. the mystery box of errors. 🎁

okay that's the whole page, you ate that. πŸ’… no skimming, i saw you.

and that's a wrap, bestie!! this was MPI_Rsend(3) from the MPI manual, dated 4/10/2026 β€” go forth and ready-send responsibly, mwah πŸ«ΆπŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from