MPI_Neighbor_allgather_init(3)

πŸ’– MPI_Neighbor_allgather_init(3) πŸ’–

okay bestie, so this one lives in the MPI manual section (section 3, the library-calls girlies πŸ’…), and it's MPI_Neighbor_allgather_init. she's the persistent-request version of neighbor_allgather, and she's lowkey iconic.


✨ NAME ✨

MPI_Neighbor_allgather_init β€” Create a persistent request for neighbor_allgather. slay, that's literally the whole job πŸŽ€


🌸 SYNOPSIS 🌸

int MPI_Neighbor_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_Neighbor_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, bestie: the regular one with int counts, and the _c one with MPI_Count counts for when you're being Extraβ„’ with big numbers πŸ¦‹


🫢 INPUT PARAMETERS 🫢

  • sendbuf β€” starting address of send buffer (choice). that's where the tea you're sending lives πŸ’Œ
  • sendcount β€” number of elements sent to each neighbor (non-negative integer). per neighbor, not total, iykyk
  • sendtype β€” data type of send buffer elements (handle)
  • recvcount β€” number of elements received from each neighbor (non-negative integer)
  • recvtype β€” data type of receive buffer elements (handle)
  • comm β€” communicator with topology structure (handle). she needs the topo, no cap
  • info β€” info argument (handle)

πŸ’… OUTPUT PARAMETERS πŸ’…

  • recvbuf β€” starting address of receive buffer (choice). where the incoming stuff lands πŸ“
  • request β€” communication request (handle). hold onto this one, she's your persistent girlie ✨

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

This routine is thread-safe. what that means: you can call it from multiple threads at the same time and you do not need to bring your own user-provided thread locks. no gatekeeping, no drama. periodt.

but heads up β€” the routine is not interrupt safe. typically this is because of memory allocation routines like malloc or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so like... thread-safe βœ…, interrupt-safe 🚫. note the difference bestie, it matters.


🌈 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 are invoked with the call statement β€” that's just how Fortran does, iconic honestly.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, even the handles. 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 😭 (yes, for real, the whole 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 β€” don't do it bestie, that's not the move πŸ™ˆ.

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. so... sometimes she bounces back, sometimes she doesn't. no promises 🧚

  • 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.
  • 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.

ok that's the whole page bestie, go forth and make persistent requests responsibly πŸ’–

and that's a wrap!! this was the MPI manual, dated 4/10/2026, and you've been reading MPI_Neighbor_allgather_init(3). mwah, bye πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from