MPI_Ssend_init(3)

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

πŸ’– 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 in MPI_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 be 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.
  • 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.
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to 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