MPI_Neighbor_alltoallv_init(3)
๐ 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). Entryjspecifies the displacement (relative tosendbuf) from which send the outgoing data to neighborj(integer). basically the map of "where in the send buffer does neighborj'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). Entryispecifies the displacement (relative torecvbuf) at which to place the incoming data from neighbori(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_WTIMEandMPI_WTICK) has an extra argumentierrat the end of the argument list.ierris 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
callstatement โจ - all MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin 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 inMPI_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 uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call โ ๏ธMPI_ERR_OTHERโ Other error; useMPI_Error_stringto 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
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 ยท other
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms