MPIX_Comm_get_stream(3)

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

πŸ’– 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 called idx. 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_WTIME and MPI_WTICK) gets an extra argument ierr at the end of the argument list. ierr is 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 call statement.
  • all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in 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 in MPI_Comm_rank). not the null comm, bestie, it will not eat πŸ’€
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to 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