MPI_Ssend_init(3)
π MPI_Ssend_init β bestie's guide to the persistent synchronous send π
okay so this page is from the MPI manual, section 3, and it's all about MPI_Ssend_init(3) β creating a persistent request for a synchronous send. buckle up, this one's a whole vibe β¨
πΈ NAME πΈ
MPI_Ssend_init β Creates a persistent request for a synchronous send π«Ά
like. it makes the request once, and you get to reuse it. iconic behavior honestly.
β¨ SYNOPSIS β¨
int MPI_Ssend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Ssend_init_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, MPI_Request *request)
two flavors bestie π
the regular one and the _c one where count is an MPI_Count instead of an int. same energy, bigger number energy.
π INPUT PARAMETERS π
bufβ initial address of send buffer (choice). this is where your data is living.countβ number of elements sent (non-negative integer). no negative counts, we don't do that here πdatatypeβ type of each element (handle).destβ rank of destination (integer). who's getting the message πtagβ message tag (integer). your little label so the receiver knows what's up.commβ communicator (handle). the group chat, basically.
π OUTPUT PARAMETERS π
requestβ communication request (handle). this is your new shiny object, go forth and use it β¨
π§΅ THREAD AND INTERRUPT SAFETY π§΅
okay so the tea: this routine is thread-safe. that means multiple threads can use it at the same time with no user-provided thread locks needed. slay. π
but β and this is important bestie β it is not interrupt safe. typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines, and those things are themselves not interrupt-safe. so like. don't interrupt it. periodt.
π 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 means the same thing as the return value of the routine in C. in Fortran, MPI routines are subroutines, and you invoke them with the call statement.
also: all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, even the fancy ones. no cap.
π ERRORS π
ngl this part is long but it matters. all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines as the return value of the function, and Fortran routines in the last argument. before that value comes back, the current MPI error handler is called. and by default?? this error handler aborts the MPI job. π dramatic but real.
the error handler can be changed with:
MPI_Comm_set_errhandler(for communicators)MPI_File_set_errhandler(for files)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, if you can help it).
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 fr fr π€
here's the error code roster:
MPI_SUCCESSβ No error; MPI routine completed successfully. πMPI_ERR_ARGβ Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid. πMPI_ERR_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank). π¬MPI_ERR_COUNTβ Invalid count argument. Count arguments 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.MPI_ERR_TYPEβ Invalid datatype argument. Additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code.
β οΈ reminder: the default error handler aborts the MPI job, so if you want those error values handed back to you instead, go set MPI_ERRORS_RETURN. your future self says thank you π«Ά
π SEE ALSO π
hmm, this page keeps it cute and self-contained β no SEE ALSO list on this one. so it's giving minimalist. π
and that's the whole page bestie!! this was MPI_Ssend_init(3) from the MPI manuals, and the footer vibes say it's from 4/10/2026. mwah π go make some persistent requests, you absolute icon πβ¨
π¦ 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