MPIX_Stream_send(3)
π 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_WTIMEandMPI_WTICK) has an extra argumentierrtacked on at the end of the argument list. ierris 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
callstatement. - All MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin 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 communicatorsMPI_File_set_errhandlerβ for filesMPI_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 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.
π 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
- 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