MPIX_Stream_send(3)

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

πŸ’Œ MPIX_Stream_send(3) β€” the MPI girlies' guide πŸ’Œ

okay so bestie, welcome to MPIX_Stream_send(3), the MPI routine that slides a message from one specific local stream over to one specific destination stream. yes it's that specific. we love a routine with opinions πŸ’…

This page lives in section 3 of the MPI manual, so if you're citing it: MPIX_Stream_send(3). periodt.


✨ NAME ✨

MPIX_Stream_send β€” send a message from a specific local stream to a specific destination stream πŸ¦‹


🌸 SYNOPSIS 🌸

int MPIX_Stream_send(const void *buf, int count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm, int source_stream_index,
int dest_stream_index)

int MPIX_Stream_send_c(const void *buf, MPI_Count count, MPI_Datatype datatype,
int dest, int tag, MPI_Comm comm,
int source_stream_index, int dest_stream_index)

Two flavors, no cap: the regular one and the _c one that takes an MPI_Count. pick your fighter πŸ’–


πŸ‘‘ INPUT PARAMETERS πŸ‘‘

  • buf β€” initial address of send buffer (choice). it's giving "where the goods live".
  • count β€” number of elements in send buffer (non-negative integer). no negative counts, bestie, that's not it.
  • datatype β€” datatype of each send buffer element (handle). tell MPI what kind of little guys you're shipping.
  • dest β€” rank of destination (integer). who's getting the message πŸŽ€
  • tag β€” message tag (integer). label it so the receiver knows what's up.
  • comm β€” communicator (handle). the group chat this whole thing happens in.
  • source_stream_index β€” source_stream_index (integer). the local stream we're sending from.
  • dest_stream_index β€” dest_stream_index (integer). the destination stream we're sending to.

🧡 THREAD AND INTERRUPT SAFETY 🧡

okay so the good news first: this routine is thread-safe. that means multiple threads can use it at the same time, and you don't have to bring your own thread locks β€” MPI's got you 🫢 literally no user-provided thread locks required.

the not so good news: it is not interrupt safe. and why? typically because of memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so it's giving "great in threads, do not interrupt" 😭


🧚 NOTES FOR FORTRAN 🧚

if you're a Fortran girly, listen up:

  • Every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) has an extra argument ierr tacked on at the end of the argument list.
  • ierr is an integer and it 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.
  • All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.

no cap, that ierr is just the C return value wearing a little Fortran hat πŸ’œ


πŸ’€ ERRORS πŸ’€

so here's the vibe: all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value. C routines return it as the value of the function, Fortran routines return it in the last argument. before that value comes back, the current MPI error handler gets called. by default, that handler aborts the MPI job β€” dramatic, but that's literally what it does.

you can swap the error handler 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 too, but heads up: its use is deprecated πŸ™ˆ

if you'd rather have error values handed back to you instead of the whole job getting aborted, the predefined error handler MPI_ERRORS_RETURN is the one β€” it makes error values get returned.

⚠️ important caveat bestie: MPI does not guarantee that an MPI program can continue past an error. that said, MPI implementations will attempt to continue whenever possible. so like… sometimes you survive, sometimes you don't 😭

here's the full error roster:

  • MPI_SUCCESS β€” no error; MPI routine completed successfully. the slay outcome ✨
  • 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.

🌈 SEE ALSO 🌈

(no SEE ALSO section in this page, bestie β€” this one's a standalone icon πŸ‘‘)


okay that's the whole page, you ate it up πŸ’… go forth and stream responsibly.

this page was brought to you by the good people at MPI, dated 4/10/2026, and it's filed under MPIX_Stream_send(3). mwah 🫢✨

πŸ“¦ where this page comes from