MPIX_Stream_recv(3)

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

πŸ’– MPIX_Stream_recv β€” from the MPI manual, bestie πŸ’–

okay so. this is the manual page for MPIX_Stream_recv, and it's genuinely kinda niche but so good when you need it. we're doing it properly, no skimming, promise 🫢


✨ NAME ✨

MPIX_Stream_recv β€” Receive a message from a specific source stream to a specific local stream.

like, not just any stream. a specific stream. on both ends. we're being picky and that's the whole point, periodt πŸ’…


🌈 SYNOPSIS 🌈

int MPIX_Stream_recv(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, int source_stream_index,
int dest_stream_index, MPI_Status *status)

int MPIX_Stream_recv_c(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm,
int source_stream_index, int dest_stream_index,
MPI_Status *status)

two flavors, same energy: the regular one with an int count, and the _c one where count is an MPI_Count (iykyk β€” big counts need big types) πŸ”₯


πŸŽ€ INPUT PARAMETERS πŸŽ€

  • count β€” number of elements in receive buffer (non-negative integer). zero is often fine, don't stress.
  • datatype β€” datatype of each receive buffer element (handle)
  • source β€” rank of source or MPI_ANY_SOURCE (integer)
  • tag β€” message tag or MPI_ANY_TAG (integer)
  • comm β€” communicator (handle)
  • source_stream_index β€” source_stream_index (integer). yes that's literally what the manpage says and we're keeping it exactly, lol πŸ™ˆ
  • dest_stream_index β€” dest_stream_index (integer). same deal, iconic, no notes ✨

πŸ’œ OUTPUT PARAMETERS πŸ’œ

  • buf β€” initial address of receive buffer (choice)
  • status β€” status object (Status)

(yes, buf is chillin' in the output section in the original and we are NOT moving it. respect the source material πŸ’–)


🧚 THREAD AND INTERRUPT SAFETY 🧚

this routine is thread-safe. translation: multiple threads can use it at the same time and you do not need to bring your own thread locks. no gatekeeping, she's fine on her own 🌸

bUT β€” and this is the important lil asterisk β€” it is not interrupt safe. typically this is because it uses memory allocation routines like malloc or other non-MPICH runtime routines that themselves aren't interrupt-safe. so like. thread-safe: yes. interrupt-safe: bestie no. keep that in mind πŸ‘‘


πŸ¦‹ NOTES FOR FORTRAN πŸ¦‹

every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets an extra argument ierr tacked on the end of the argument list. ierr is an integer and means exactly the same thing as the return value of the routine in C. and in Fortran, MPI routines are subroutines invoked with the call statement. that's just the vibe over there ✨

also: all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. no cap πŸ’…


⭐ ERRORS ⭐

every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines as the return value of the function, Fortran routines in the last argument. and before that value comes back to you, the current MPI error handler gets called. by default, that error handler aborts the MPI job 😭 so yeah, know your handler.

the error handler can be changed 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 but its use is deprecated πŸ‘€ β€” don't be that girl.

you can also use the predefined error handler MPI_ERRORS_RETURN to make error values actually get returned to you instead of the job just dying.

note that MPI does not guarantee an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so like… maybe you survive? maybe you don't? πŸ™ˆ

here's the error code lineup:

  • 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. (yes "the the" β€” that's the original, we're preserving history here 🫢)
  • 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.

okay bestie that's the whole page, nothing skipped, every flag and code intact πŸ’– this one's from the MPIX_Stream_recv(3) manual page, dated 4/10/2026, and it's part of the MPI family. go receive something specific, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from