MPI_Ibsend(3)
π MPI_Ibsend(3) β the MPI manual page, bestie edition β¨
okay so. you wanna send stuff but you don't wanna wait around for it, and you also wanna have a buffer holding onto it for you. that's this girl. she's MPI_Ibsend, and she's the nonblocking buffered send. I for "immediately go do your own thing", b for "buffered". she's a whole vibe. π
πΈ NAME πΈ
MPI_Ibsend β starts a nonblocking buffered send. she starts it. she does not finish it. that part is on you, bestie. π
π¦ SYNOPSIS π¦
int MPI_Ibsend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Ibsend_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, MPI_Request *request)
two flavors, no cap β the regular one and the <lavender>_cone, where the count has main character energy and gets to be anMPI_Countinstead of a plainint`. π
π INPUT PARAMETERS π
bufβ the initial address of the send buffer. that's the "choice" type, iykyk. this is where your data lives. she reads from here. πcountβ number of elements in the send buffer. a non-negative integer, so like. zero and up. no negatives, that's not the move.datatypeβ the datatype of each send buffer element. it's a handle. (this is the "what even is each little guy in my buffer" question.) β¨destβ the rank of the destination. an integer. this is WHO you're sending to.tagβ the message tag. an integer. this is the little label so the other side knows which message this is. πcommβ the communicator. a handle. this is the group chat you're sending in. π«Ά
π OUTPUT PARAMETERS π
requestβ the communication request. it's a handle, and it is literally the receipt for your nonblocking send. hold onto it, because you're gonna need it later to actually check on this whole situation. π
π₯ THREAD AND INTERRUPT SAFETY π₯
okay so the tea: this routine is thread-safe. she can be used by multiple threads at the same time with zero user-provided thread locks. no lock-wrangling required from you. slay. π
BUT. she is not interrupt safe. and the reason is usually that she touches memory allocation routines like malloc, or other non-MPICH runtime routines that themselves are not interrupt-safe. so like, threads? fine. interrupts? not the vibe. π
π§ NOTES FOR FORTRAN π§
- every MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) gets one extra argument tacked onto the end of the argument list:ierr. it's an integer, and it means exactly the same thing that the return value means in C. - in Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. yes,call. periodt. - every MPI object (e.g.,
MPI_Datatype,MPI_Comm) is of typeINTEGERin Fortran. all of them. 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, 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, goodnight. π΅
you can change that 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 β heads up β its use is deprecated. π
the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead. and note: MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. so like, they'll try. no promises though. π«
MPI_SUCCESSβ no error, she ate, the MPI routine completed successfully. β¨MPI_ERR_ARGβ invalid argument. something in there is invalid and it isn't identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ invalid buffer pointer. usually it's a null buffer where a null buffer is not valid. bestie. why is it null.MPI_ERR_COMMβ invalid communicator. the classic rookie move is using a null communicator in a call (not even allowed inMPI_Comm_rank).MPI_ERR_COUNTβ invalid count argument. counts 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" β that's verbatim, we don't edit the ancestors.) ποΈMPI_ERR_TYPEβ invalid datatype argument. also, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. commit your types, bestie, they're not gonna commit to you if you don't commit to them. πMPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the "idk figure it out" of error codes. π
real talk: nonblocking buffered send means the buffering is doing a lot of heavy lifting for you, but the request handle is yours to babysit. don't lose it. π
and that's the whole page!! this one's from the MPI manual, dated 4/10/2026, and it's page MPI_Ibsend(3) if you need to cite her in your group project. mwah, go forth and send nonblockingly, bestie ππ¦β¨
π¦ 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