MPIX_Comm_get_stream(3)
π MPIX_Comm_get_stream β bestie edition π
okay so this is the MPIX_Comm_get_stream(3) page from the MPI manual, and we're gonna get through it together, no stress π«Ά
β¨ NAME β¨
MPIX_Comm_get_stream β get the stream object that is attached to the communicator π
literally its whole job. you hand it a communicator, it hands you back the stream object attached to it. iconic behavior, no notes.
β¨ SYNOPSIS β¨
int MPIX_Comm_get_stream(MPI_Comm comm, int idx, MPIX_Stream *stream)
β¨ INPUT PARAMETERS β¨
commβ communicator (handle). the one you're pulling the stream off of, bestie πidxβ idx (integer). yes it's just calledidx. the index, girl.
β¨ OUTPUT PARAMETERS β¨
streamβ stream object (handle). this is where the answer lands β¨
β¨ THREAD AND INTERRUPT SAFETY β¨
good news first: this routine is thread-safe π which means multiple threads can use it at the same time and you do not need to bring your own thread locks. none. zero. you're welcome.
but β and I need you to hear me on this β it is not interrupt safe. π the usual reason is that it uses memory allocation routines like malloc, or other non-MPICH runtime routines that themselves aren't interrupt-safe. so like, don't interrupt it. rude.
β¨ NOTES FOR FORTRAN β¨
for my Fortran girlies π
- every MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) gets an extra argumentierrat the end of the argument list.ierris an integer and it means the same thing as the return value of the routine does 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.
β¨ ERRORS β¨
so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines as the value of the function, and Fortran routines in that last argument. before the value comes back to you, the current MPI error handler gets called. by default, that error handler aborts the MPI job. π
you can switch the error handler 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 too, but heads up, its use is deprecated. π
the predefined error handler MPI_ERRORS_RETURN can be used to make error values actually get returned to you. also note: MPI does not guarantee that an MPI program can continue past an error β but MPI implementations will attempt to continue whenever possible.
here's the whole roster of error codes, no skipping:
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_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank). not the null comm, bestie, it will not eat πMPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code.
and that's the whole page, you ate that fr fr π₯
lowkey reminder: this is all from the MPI manual, dated 4/10/2026 π mwah, go write some very correct code π
bye bestie, ily, stream responsibly β¨π π¦
π¦ 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