MPI_Iallgather(3)

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

πŸ’– MPI_Iallgather(3) πŸ’–

okay bestie, welcome to the MPI manual page for MPI_Iallgather β€” yes that's the MPI section of the manual, and this is the nonblocking girlie of the gather family. Let's get into it ✨

πŸ”₯ NAME πŸ”₯

MPI_Iallgather β€” Gathers data from all tasks and distribute the combined data to all tasks in a nonblocking way

like. everyone yells their lil piece into the void, everyone gets the whole group chat back, and nobody sits around waiting because it's nonblocking. main character energy fr fr πŸ’…


✨ SYNOPSIS ✨

int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm, MPI_Request *request)
int MPI_Iallgather_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf, MPI_Count recvcount,
MPI_Datatype recvtype, MPI_Comm comm,
MPI_Request *request)

🫢 INPUT PARAMETERS 🫢

so these are the things you hand to the function. the gossip you're contributing, basically:

  • sendbuf β€” starting address of send buffer (choice). it's where your contribution lives, bestie πŸŽ€
  • sendcount β€” number of elements in send buffer (non-negative integer). count 'em, and no negatives allowed periodt
  • sendtype β€” data type of send buffer elements (handle). tells MPI what flavour of thing you're shipping
  • recvcount β€” number of elements received from any process (non-negative integer). again: non-negative, we don't do negative counts here πŸ™ˆ
  • recvtype β€” data type of receive buffer elements (handle)
  • comm β€” communicator (handle). the group chat itself, iykyk

πŸ’œ OUTPUT PARAMETERS πŸ’œ

and these are what you get back. the tea β˜•

  • recvbuf β€” address of receive buffer (choice). this is where everybody's contributions land. it's giving potluck πŸ“
  • request β€” communication request (handle). the lil ticket you hold onto so you can check on your nonblocking operation later 🌸

🌈 THREAD AND INTERRUPT SAFETY 🌈

okay important, bestie, listen up:

This routine is thread-safe. That means this routine may be safely used by multiple threads without the need for any user-provided thread locks. slay, no mutex required, we love to see it πŸ‘‘

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… threads? fine. interrupts? NOT fine. don't come for me πŸ’€

πŸŽ€ NOTES FOR FORTRAN πŸŽ€

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

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

like yes, everything is just an INTEGER over there, that's the vibe πŸ¦‹


πŸ’€ 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. 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. 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.

default behaviour is literally "the whole job dies" so maybe set your errhandler before you get comfy 😭

here's the error code lineup:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. the dream, the goal, the bare minimum πŸ’–
  • 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. like bestie you gave me nothing 🫠
  • MPI_ERR_COMM β€” Invalid communicator. A common error is to use a null communicator in a call (not even allowed in MPI_Comm_rank ). yes, even MPI_Comm_rank won't tolerate that nonsense
  • MPI_ERR_COUNT β€” Invalid count argument. Count arguments must be non-negative; a count of zero is often valid. zero? maybe fine. negative? absolutely not.
  • 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. commit your types first, it's the law πŸ’…
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

and that's the whole page, no notes 🧚

this was MPI_Iallgather(3) from the MPI manual, dated 4/10/2026 β€” mwah, go forth and gather nonblockingly, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from