MPI_Allgather_init(3)
π MPI_Allgather_init(3) π
okay bestie, welcome to the MPI manual, section 3, and today's main character is MPI_Allgather_init. no cap.
β¨ NAME β¨
MPI_Allgather_init β create a persistent request for allgather. yes, that's literally the whole vibe. persistent. request. allgather. slay. π
πΈ SYNOPSIS πΈ
int MPI_Allgather_init(const void *sendbuf, int sendcount,
MPI_Datatype sendtype, void *recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm, MPI_Info info,
MPI_Request *request)
int MPI_Allgather_init_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
MPI_Count recvcount, MPI_Datatype recvtype,
MPI_Comm comm, MPI_Info info, MPI_Request *request)
two flavors, one iconic duo π
π¦ INPUT PARAMETERS π¦
sendbufβ starting address of send buffer (choice). it's giving "here's my stuff, take it"sendcountβ number of elements in send buffer (non-negative integer). non-negative, bestie, we do not do negatives here πsendtypeβ data type of send buffer elements (handle)recvcountβ number of elements received from any process (non-negative integer)recvtypeβ data type of receive buffer elements (handle)commβ communicator (handle). the friend group chat of MPIinfoβ info argument (handle)
π OUTPUT PARAMETERS π
recvbufβ address of receive buffer (choice)requestβ communication request (handle)
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. lowkey iconic. that means you can safely use it from multiple threads and you do NOT need to bring your own user-provided thread locks. no gatekeeping, it handles itself.
BUT. and this is the important but π β the routine is not interrupt safe. typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so yeah, threads: yes. interrupts: not the move. π
π 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 they're invoked with the call statement.
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. periodt.
β 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 π (yes, really, it just ends it all).
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 β it's giving legacy, we don't stan π«Ά. 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. okay that's actually kinda sweet of them.
MPI_SUCCESSβ No error; MPI routine completed successfully. π the dreamMPI_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. bestie you forgot the buffer π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_INFOβ Invalid InfoMPI_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.
and that's the whole page, babes π go forth and gather, persistently.
ngl if you read all the way to the end you're genuinely built different π§
this lil drop was brought to you by MPI, dated 4/10/2026, in the MPI_Allgather_init(3) era β stay persistent β¨ππ¦
π¦ 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