MPI_Igatherv(3)

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

πŸ’… MPI_Igatherv(3) β€” the manual page, but make it make sense

okay bestie, welcome to MPI_Igatherv, straight out of the MPI manual set (yes, the whole MPI collection, we love her). this is the nonblocking version of the gatherv vibes, and she's giving main character energy ✨


✨ NAME ✨

MPI_Igatherv β€” Gathers into specified locations from all processes in a group in a nonblocking way πŸ¦‹

like. she gathers. from everybody. into your chosen spots. and she does it nonblocking, so you're not just sitting there waiting, you're living your life πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int displs[],
MPI_Datatype recvtype, int root, MPI_Comm comm,
MPI_Request *request)

int MPI_Igatherv_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
const MPI_Count recvcounts[], const MPI_Aint displs[],
MPI_Datatype recvtype, int root, MPI_Comm comm,
MPI_Request *request)

two flavors, no cap: the classic one and the _c one with the big MPI_Count / MPI_Aint energy 🧚


🌸 INPUT PARAMETERS 🌸

the stuff you hand her before she does her thing:

  • sendbuf β€” starting address of send buffer (choice). where your lil data lives, bestie 🫢
  • sendcount β€” number of elements in send buffer (non-negative integer). no negatives, we don't do that here 😭
  • sendtype β€” 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). so like, one count per process, and she's keeping receipts 🧾
  • displs β€” integer array (of length group size). Entry i specifies the displacement relative to recvbuf at which to place the incoming data from process i (integer). so process i's stuff lands at that offset, iconic behavior πŸ‘‘
  • recvtype β€” data type of recv buffer elements (handle)
  • root β€” rank of receiving process (integer). the one main character collecting everything πŸ’–
  • comm β€” communicator (handle)

πŸ’œ OUTPUT PARAMETERS πŸ’œ

what you get back:

  • recvbuf β€” address of receive buffer (choice)
  • request β€” communication request (handle). hold onto this one, she's your ticket to checking in later ✨

πŸ”₯ THREAD AND INTERRUPT SAFETY πŸ”₯

good news: this routine is thread-safe. that means multiple threads can use it at the same time, and you do not need to bring your own user-provided thread locks. slay πŸ’…

but β€” and this is the plot twist β€” the routine is not interrupt safe. typically this is because of memory allocation routines like malloc, or other non-MPICH runtime routines, which are themselves not interrupt-safe. so like, threads? fine. interrupts? not it. πŸ™ˆ


🌈 NOTES FOR FORTRAN 🌈

fr fr, Fortran besties, this part is for you:

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 are invoked with the call statement.

All MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in Fortran.

periodt. πŸ“Œ


πŸ’€ ERRORS πŸ’€

okay so here's the deal. 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, like, full on. 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 (ma'am, retire). 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 so β€” MPI does not pinky promise your program survives an error. implementations will try to keep going whenever possible, but that's a vibe, not a guarantee 🫢

the actual error codes, in order:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. we love a clean run ✨
  • 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_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.

and that's the whole page, bestie πŸŽ€ this was written from the MPI MPI_Igatherv(3) page, dated 4/10/2026 β€” go gather, nonblocking, and slay πŸ’–βœ¨

πŸ“¦ where this page comes from