MPI_Neighbor_alltoallv_init(3)

๐Ÿ“ฆ
version 5.0.1 ยท 5 versions
, in nixos 26.05, ubuntu stonking

๐Ÿ’– MPI_Neighbor_alltoallv_init(3) ๐Ÿ’–

okay bestie, so this one lives in the MPI manual, section 3, and it's called MPI_Neighbor_alltoallv_init โ€” say that five times fast, I dare you ๐Ÿซถ


โœจ NAME โœจ

MPI_Neighbor_alltoallv_init โ€” bestie, this literally creates a persistent request for neighbor_alltoallv. That's it. That's the whole job. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

int MPI_Neighbor_alltoallv_init(const void *sendbuf, const int sendcounts[],
const int sdispls[], MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[],
const int rdispls[], MPI_Datatype recvtype,
MPI_Comm comm, MPI_Info info,
MPI_Request *request)

int MPI_Neighbor_alltoallv_init_c(const void *sendbuf,
const MPI_Count sendcounts[],
const MPI_Aint sdispls[],
MPI_Datatype sendtype, void *recvbuf,
const MPI_Count recvcounts[],
const MPI_Aint rdispls[],
MPI_Datatype recvtype, MPI_Comm comm,
MPI_Info info, MPI_Request *request)

two flavors, same energy: the classic one and the _c one that rolls with MPI_Count and MPI_Aint โœจ


๐Ÿ’Œ INPUT PARAMETERS ๐Ÿ’Œ

  • sendbuf โ€” starting address of send buffer (choice). where your lil outgoing data hangs out ๐Ÿ’–
  • sendcounts โ€” non-negative integer array (of length outdegree) specifying the number of elements to send to each neighbor (non-negative integer). one entry per neighbor you're pushing data to ๐Ÿซถ
  • sdispls โ€” integer array (of length outdegree). Entry j specifies the displacement (relative to sendbuf) from which send the outgoing data to neighbor j (integer). basically the map of "where in the send buffer does neighbor j's stuff start" ๐Ÿ—บ๏ธ
  • sendtype โ€” data type of send buffer elements (handle) โœจ
  • recvcounts โ€” non-negative integer array (of length indegree) specifying the number of elements that are received from each neighbor (non-negative integer) ๐ŸŽ€
  • rdispls โ€” integer array (of length indegree). Entry i specifies the displacement (relative to recvbuf) at which to place the incoming data from neighbor i (integer) ๐Ÿ’
  • recvtype โ€” data type of receive buffer elements (handle) ๐ŸŒธ
  • comm โ€” communicator with topology structure (handle). it's giving topology, it's giving structure ๐Ÿฆ‹
  • info โ€” info argument (handle) โ„น๏ธ

๐Ÿ‘‘ OUTPUT PARAMETERS ๐Ÿ‘‘

  • recvbuf โ€” starting address of receive buffer (choice). the lil landing pad for everything coming in ๐Ÿ’–
  • request โ€” communication request (handle). this is the persistent one, hold onto it like it's your iced coffee ๐Ÿง‹

๐Ÿ”ฅ THREAD AND INTERRUPT SAFETY ๐Ÿ”ฅ

good news: this routine is thread-safe. that means multiple threads can use it with zero user-provided thread locks, no cap. you don't gotta babysit it ๐Ÿซถ

but โ€” and this is the part where we get serious โ€” it is not interrupt safe. typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, don't go interrupting it mid-vibe ๐Ÿ˜ญ


๐ŸŒˆ NOTES FOR FORTRAN ๐ŸŒˆ

  • every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) has an extra argument ierr at the end of the argument list. ierr is an integer and means the exact same thing as the return value of the routine in C ๐Ÿ“
  • in Fortran, MPI routines are subroutines and you invoke them with the call statement โœจ
  • all MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran ๐Ÿ’…

๐Ÿ’€ ERRORS ๐Ÿ’€

so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value โ€” C routines as the value of the function, Fortran routines in that last argument. before the value comes back, the current MPI error handler gets called. by default, this error handler aborts the MPI job ๐Ÿ˜ญ so yeah, default behavior is dramatic.

the error handler can 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 (iykyk, don't).

the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. also: MPI does not guarantee that an MPI program can continue past an error โ€” however, MPI implementations will attempt to continue whenever possible ๐Ÿ™

here's the full roster of error codes, bestie:

  • MPI_SUCCESS โ€” No error; MPI routine completed successfully ๐ŸŽ‰
  • 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 ๐Ÿ”

that's the whole page, periodt ๐Ÿ’… go forth and Neighbor_alltoallv_init responsibly, bestie ๐Ÿซถ

sign-off time: this was served fresh from the MPI source, dated 4/10/2026, and it's MPI_Neighbor_alltoallv_init(3) and proud ๐Ÿ’– mwah, go slay โœจ๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from