MPI_Ssend(3)
π MPI_Ssend β bestie's guide to the blocking synchronous send π
okay so. welcome to the MPI manual, bestie π«Ά this one's all about MPI_Ssend, and no cap, it's kind of a big deal in your MPI era.
β¨ NAME β¨
MPI_Ssend β Blocking synchronous send. yes she blocks, yes she's synchronous, and yes she sends. main character energy fr fr π
πΈ SYNOPSIS πΈ
int MPI_Ssend(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm)
int MPI_Ssend_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm)
two flavors, both slay. MPI_Ssend uses a regular int count, and MPI_Ssend_c is the big-count version with MPI_Count count. pick your fighter π
π INPUT PARAMETERS π
bufβ initial address of send buffer (choice). it's a choice bestie, so it can be whatever type you want, that's the whole vibe β¨countβ number of elements in send buffer (non-negative integer). keep it>= 0, we don't do negative counts here πdatatypeβ datatype of each send buffer element (handle). this is how MPI knows what your bytes actually are π¦destβ rank of destination (integer). who's getting this message, bestietagβ message tag (integer). the little label so the receiver knows what's upcommβ communicator (handle). your group chat, basically π¬
π THREAD AND INTERRUPT SAFETY π
good news, this routine is thread-safe π that means you can safely call it from multiple threads without needing to bring your own user-provided thread locks. no extra scaffolding required, she's self-sufficient.
but she is NOT interrupt safe, bestie. rip π typically this is because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, threads yes, interrupts no. noted. π
π§ NOTES FOR FORTRAN π§
all MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. in Fortran, MPI routines are subroutines, and they get invoked with the call statement. so very old-school, so very cute. π
also! all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes really, all of them. that's just the Fortran lore, iykyk π¦
π 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 that last argument. before the value is returned, the current MPI error handler gets called. by default, this error handler aborts the MPI job, which is very dramatic of it π
the error handler may be changed 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. fingers crossed, manifesting π€β¨
here's the full roster of error codes, no skips:
MPI_SUCCESSβ No error; MPI routine completed successfully. we love a happy ending π₯³MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid. bestie. you gave it nothing. πMPI_ERR_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank). yeah that one's that serious.MPI_ERR_COUNTβ Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. so zero can be fine, negative can never be fine π§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. note the receive part, bestie, sends don't getMPI_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 original says "the the", i'm just the messenger π«Ά)MPI_ERR_TYPEβ Invalid datatype argument. Additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call. commit your types, bestie, i'm begging πMPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code. the β¨mysteryβ¨ option
and that's the whole page, periodt π
this was the MPI MPI_Ssend(3) page, dated 4/10/2026 β so if you're reading this, hi from that exact date, hope your ranks are valid and your buffers aren't null πβ¨π¦
π¦ 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