MPI_Allgatherv_init(3)
π MPI_Allgatherv_init π
okay bestie, so this page is MPI_Allgatherv_init(3) from the MPI manual, and it's literally the glow-up version of allgatherv: instead of doing the whole dance every single time, you set it up once as a persistent request and then just keep reusing it. obsessssed. π
β¨ NAME β¨
MPI_Allgatherv_init β Create a persistent request for allgatherv. π
no cap, that's the whole vibe: it creates a persistent request for allgatherv. it does not do the gathering, it sets you up so you can do the gathering again and again. main character energy fr.
πΈ SYNOPSIS πΈ
C version:
int MPI_Allgatherv_init(const void *sendbuf, int sendcount,
MPI_Datatype sendtype, void *recvbuf,
const int recvcounts[], const int displs[],
MPI_Datatype recvtype, MPI_Comm comm, MPI_Info info,
MPI_Request *request)
and the big-number girlie version, _c, for when your counts and displacements are simply Too Much for plain int:
int MPI_Allgatherv_init_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
const MPI_Count recvcounts[], const MPI_Aint displs[],
MPI_Datatype recvtype, MPI_Comm comm, MPI_Info info,
MPI_Request *request)
π¦ INPUT PARAMETERS π¦
sendbufβ starting address of send buffer (choice). this is the stuff you're sending out into the world πsendcountβ number of elements in send buffer (non-negative integer). must be>= 0, no negativity allowed in this housesendtypeβ data type of send buffer elements (handle)recvcountsβ non-negative integer array (of length group size) containing the number of elements that are received from each process (non-negative integer). one slot per process bestie, and slot i tells you how much process i is sending youdisplsβ integer array (of length group size). Entryispecifies the displacement (relative torecvbuf) at which to place the incoming data from processi(integer). it's the seating chart fr, everyone gets their assigned spot πͺrecvtypeβ data type of receive buffer elements (handle)commβ communicator (handle)infoβ info argument (handle)
π OUTPUT PARAMETERS π
recvbufβ address of receive buffer (choice)requestβ communication request (handle). this is the persistent request you just birthed, keep it safe β¨
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. slay. that means this routine may be safely used by multiple threads without the need for any user-provided thread locks. let the threads cook, no extra locking needed π«Ά
β οΈ BUT. However. The routine is not interrupt safe. π Typically, this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, don't go interrupting it mid-malloc, that's the tea.
π 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. it's giving "same energy, different outfit". β¨
In Fortran, MPI routines are subroutines, and they are invoked with the call statement. so: call. iconic behavior.
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. not dramatic at all, it just ends everything π
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 β we don't do that anymore bestie, it's giving 1994. π
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. fingers crossed fr fr.
Here's the lineup of error codes, no gatekeeping:
MPI_SUCCESSβ No error; MPI routine completed successfully. we LOVE to see it π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. the classic null moment πMPI_ERR_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank). like, evenMPI_Comm_ranksaid no thanks.MPI_ERR_COUNTβ Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. zero is fine, negative is not, we do not tolerate negativity here β¨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. commit your types, bestie, don't send them out uncommitted πMPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code. the mysterious one, go read its diary viaMPI_Error_string
and that's the whole page, bestie, you ate it π β¨
this was MPI_Allgatherv_init(3) from the MPI manual, dated 4/10/2026 β go forth and make some persistent requests, you've got this π«ΆπΈ
π¦ 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