MPI_RSEND(3)

πŸ’– NAME πŸ’–

MPI_Rsend β€” ready send. yeah that's it, that's the whole vibe. it sends. but ready. 🏁


✨ SYNTAX ✨

bestie there are three flavors and you gotta pick yours, no cap.

🌸 C Syntax

#include <mpi.h>

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

πŸ¦‹ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_RSEND(BUF, COUNT, DATATYPE, DEST, TAG, COMM, IERROR)
     <type>  BUF(*)
     INTEGER COUNT, DATATYPE, DEST, TAG, COMM, IERROR

πŸŽ€ Fortran 2008 Syntax

USE mpi_f08
MPI_Rsend(buf, count, datatype, dest, tag, comm, ierror)
     TYPE(*), DIMENSION(..), INTENT(IN) :: buf
     INTEGER, INTENT(IN) :: count, dest, tag
     TYPE(MPI_Datatype), INTENT(IN) :: datatype
     TYPE(MPI_Comm), INTENT(IN) :: comm
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ’… INPUT PARAMETERS πŸ’…

the tea you gotta hand over, one by one, no skips:

  • buf β€” initial address of send buffer (choice). where the goodies live πŸ“¦
  • count β€” number of elements in send buffer (nonnegative integer). pls don't make it negative, that's not the moment πŸ™ˆ
  • datatype β€” datatype of each send buffer element (handle).
  • dest β€” rank of destination (integer). who's getting the message, name names.
  • tag β€” message tag (integer). the little label so your receive knows what's up.
  • comm β€” communicator (handle). the group chat you're posting in πŸ’¬

🫢 OUTPUT PARAMETER 🫢

  • ierror β€” Fortran only: error status (integer). the "how did it go" report card.

πŸ”₯ DESCRIPTION πŸ”₯

okay so. a ready send may only be called if you, the user, can guarantee that a receive is already posted. like, already there. already waiting. sitting pretty. πŸͺ‘βœ¨

not me calling a ready send before the receive is posted... that is an error. it's a hard error, bestie. the receive MUST be posted before the ready send is called. periodt.

πŸ’€ ERRORS πŸ’€

almost all MPI routines return an error value β€” C routines hand it back as the return result of the function, and Fortran routines tuck it into the last argument. πŸ“¬

before that error value comes back to you, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. and if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. that initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. and if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. 😭

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. yes, all of them. πŸ’₯
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as if MPI_Abort was called on that communicator. if called on a window or file, acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. if called on a session, aborts only the local process. 🫠
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the polite one fr fr. πŸŽ€

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler

note that MPI does not guarantee that an MPI program can continue past an error. nope. no promises. πŸ™…β€β™€οΈ

see the MPI man page for a full list of MPI error codes. πŸ“œ

see the Error Handling section of the MPI-3.1 standard for more information. πŸ“š


2003-2026, The Open MPI Community


and that's a wrap, bestie 🫢 this whole thing lives in the Open MPI manual, under the page title MPI_RSEND(3) β€” and if you're squinting at the fine print at the bottom of the page, it's stamped Sep 10, 2026 and signed MPI_RSEND(3). slay, go post that receive first. πŸ’…βœ¨

πŸ“¦ where this page comes from