MPIX_Stream_recv(3)
π 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 orMPI_ANY_SOURCE(integer)tagβ message tag orMPI_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 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. (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 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.
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
- 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