MPI_Recv_init(3)
π MPI_Recv_init β bestie edition π
okay so this is MPI_Recv_init(3) from the MPI manual, and babes, it's giving setup arc. You're not receiving anything yet β you're just building the vibe so you can hit MPI_Start later and actually pop off. β¨
πΈ NAME πΈ
MPI_Recv_init β create a persistent request for a receive π
π¦ SYNOPSIS π¦
int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int source,
int tag, MPI_Comm comm, MPI_Request *request)
int MPI_Recv_init_c(void *buf, MPI_Count count, MPI_Datatype datatype,
int source, int tag, MPI_Comm comm, MPI_Request *request)
π INPUT PARAMETERS π
countβ the number of elements received, and bestie it's a non-negative integer, so pls no negatives πdatatypeβ type of each element (a handle, not a vibe)sourceβ rank of source, orMPI_ANY_SOURCE(integer). Yes you can be mysterious and accept from literally anyone πtagβ message tag, orMPI_ANY_TAG(integer)commβ communicator (handle)
π OUTPUT PARAMETERS π
bufβ initial address of receive buffer (choice)requestβ communication request (handle) π
π THREAD AND INTERRUPT SAFETY π
So this routine is thread-safe, periodt. That means multiple threads can use it safely with zero user-provided thread locks, no cap. π«Ά
BUT β and I need you to hear me on this β it is not interrupt safe. Typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. So like, iconic for threading, not built for interrupting. π
π§ NOTES FOR FORTRAN π§
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and are invoked with the call statement.
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. Fr fr, they're just integers over there. π
π₯ ERRORS π₯
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. Before the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job β so yeah, no chill by default π. The error handler may 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 (she's old, let her rest π). The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible.
β οΈ reminder bestie: default error handler = the whole job just leaves. Set your handler if you want to survive the drama.
MPI_SUCCESSβ No error; MPI routine completed successfully. she ate. π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 β
MPI_StartMPI_StartallMPI_Request_free
iykyk β init now, start later. the glow-up pipeline. π
okay that's the whole page bestie, mwah π«Ά this was the MPI_Recv_init(3) man page, MPI edition, dated 4/10/2026. go set up those requests and slay 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