MPI_Allgather_init(3)

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

πŸ’– 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 MPI
  • info β€” 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 dream
  • 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. 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 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_INFO β€” Invalid Info
  • 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, 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