MPI_Gather_init(3)

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

πŸ’– MPI_Gather_init(3) πŸ’–

okay bestie, welcome to the MPI manual, page MPI_Gather_init(3) β€” yes it's the real deal, section 3 of the MPI manual, and we're about to make a persistent request for a gather. no cap.


✨ NAME ✨

MPI_Gather_init β€” Create a persistent request for gather. that's it, that's the whole job. she creates, she persists, she serves. πŸ’…


🌸 SYNOPSIS 🌸

int MPI_Gather_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm, MPI_Info info,
MPI_Request *request)

int MPI_Gather_init_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf, MPI_Count recvcount,
MPI_Datatype recvtype, int root, MPI_Comm comm,
MPI_Info info, MPI_Request *request)

look at her. two whole signatures. the _c one is the big-count version, iykyk. πŸ¦‹


πŸŽ€ INPUT PARAMETERS πŸŽ€

  • sendbuf β€” starting address of send buffer (choice). where your lil data lives before it goes on its journey.
  • sendcount β€” number of elements in send buffer (non-negative integer). must be non-negative, we do not do negative counts here. πŸ™ˆ
  • sendtype β€” data type of send buffer elements (handle). tell her what she's sending, be specific.
  • recvcount β€” number of elements for any single receive (non-negative integer). any single receive, okay? non-negative, always.
  • recvtype β€” data type of recv buffer elements (handle).
  • root β€” rank of receiving process (integer). this is the main character of the operation, everyone's gathering for them. πŸ‘‘
  • comm β€” communicator (handle). the group chat. πŸ’¬
  • info β€” info argument (handle).

🫢 OUTPUT PARAMETERS 🫢

  • recvbuf β€” address of receive buffer (choice). where the goodies land.
  • request β€” communication request (handle). this is the persistent request itself, the whole point, the moment. ✨

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

This routine is thread-safe. and by that we mean: you can let multiple threads hit this routine at the same time and you do not need to bring your own user-provided thread locks. she handles it, she's responsible, she's grown. πŸ’…

HOWEVER. bestie. she is not interrupt safe. and typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. it's giving "can multitask but do NOT startle her". 😭


🧚 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 are invoked with the call statement. different language, different grammar, same queen behavior.
  • All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.

πŸ’œ 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 β€” like, actually ends everything, no coming back. 😭

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, she's retired).

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. optimistic queens only. 🌈

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. ate. πŸ’…
  • 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_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. commit your types first, bestie!! πŸ™ˆ
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

okay that's the whole page, you're welcome, go forth and persist your requests responsibly πŸŽ€

this was MPI_Gather_init(3), dated 4/10/2026 β€” mwah, love you, bye πŸ’–

πŸ“¦ where this page comes from