MPI_Ssend(3)

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

πŸ’– 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, bestie
  • tag β€” message tag (integer). the little label so the receiver knows what's up
  • comm β€” 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 in MPI_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 be MPI_ANY_SOURCE. note the receive part, bestie, sends don't get 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 the attribute MPI_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 uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit your types, bestie, i'm begging 😭
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to 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