MPI_Irsend(3)

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

πŸ’Œ 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 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 also exists but its use is deprecated ⚠️. you can also use the predefined error handler MPI_ERRORS_RETURN to 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 in MPI_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 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. use it, don't guess πŸ’…
  • MPI_ERR_TYPE β€” invalid datatype argument. also, this error can happen if an uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit your types first, babe 🫢
  • MPI_ERR_OTHER β€” other error; use MPI_Error_string to 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