MPI_Neighbor_alltoallw_init(3)
π MPI_Neighbor_alltoallw_init π
okay bestie, so this is a page from the MPI manual set β MPI_Neighbor_alltoallw_init(3), section 3. Pull up a chair, we're doing persistent neighbor communication today and honestly? iconic.
β¨ NAME β¨
MPI_Neighbor_alltoallw_init β she creates a persistent request for neighbor_alltoallw. That's it, that's the whole job. π
πΈ SYNOPSIS πΈ
The C version, looking all fancy:
int MPI_Neighbor_alltoallw_init(const void *sendbuf, const int sendcounts[],
const MPI_Aint sdispls[],
const MPI_Datatype sendtypes[], void *recvbuf,
const int recvcounts[],
const MPI_Aint rdispls[],
const MPI_Datatype recvtypes[], MPI_Comm comm,
MPI_Info info, MPI_Request *request)
And the big-count sibling, for when your counts are MPI_Count sized and you're feeling extra:
int MPI_Neighbor_alltoallw_init_c(const void *sendbuf,
const MPI_Count sendcounts[],
const MPI_Aint sdispls[],
const MPI_Datatype sendtypes[], void *recvbuf,
const MPI_Count recvcounts[],
const MPI_Aint rdispls[],
const MPI_Datatype recvtypes[], MPI_Comm comm,
MPI_Info info, MPI_Request *request)
π«Ά INPUT PARAMETERS π«Ά
These are the things you hand over, okay bestie, don't forget a single one:
sendbufβ the starting address of the send buffer (choice).sendcountsβ a non-negative integer array, length equals outdegree, telling us how many elements go to each neighbor (non-negative integer).sdisplsβ integer array, length outdegree. Entryjsays the displacement in bytes, relative tosendbuf, where the outgoing data destined for neighborjgets taken from (integer).sendtypesβ array of datatypes, length outdegree. Entryj= the type of data you're sending to neighborj(handle).recvcountsβ non-negative integer array, length indegree, saying how many elements get received from each neighbor (non-negative integer).rdisplsβ integer array, length indegree. Entryisays the displacement in bytes, relative torecvbuf, where the incoming data from neighborigets placed (integer).recvtypesβ array of datatypes, length indegree. Entryi= the type of data received from neighbori(handle).commβ communicator that has a topology structure (handle).infoβ info argument (handle).
π OUTPUT PARAMETERS π
The stuff that comes back to you:
recvbufβ the starting address of the receive buffer (choice).requestβ communication request (handle).
π§΅ THREAD AND INTERRUPT SAFETY π§΅
This routine is thread-safe, periodt. That means multiple threads can use it at the same time and you don't gotta provide any thread locks yourself. π
β οΈ But no cap β she is not interrupt safe. Typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines, and those cuties are themselves not interrupt-safe. So like, thread-safe yes, interrupt-safe no, don't mix those up bestie. π
π¦ NOTES FOR FORTRAN π¦
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) get one extra argument: ierr, tacked onto the end of the argument list. ierr is an integer and means the 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.
Also, every MPI object (like MPI_Datatype, MPI_Comm) is of type INTEGER in Fortran. That's just the vibe over there. π
β ERRORS β
Every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines as the return value of the function, Fortran routines in that last argument. Before the value is returned, the current MPI error handler gets called. By default, this error handler aborts the MPI job, which is giving dramatic main character exit, but maybe not what you wanted. π«
You can change the error handler 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 β like, it works, but why. π The predefined error handler MPI_ERRORS_RETURN can be used to cause error values to be returned. And note: 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 error roster:
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.
and that's the whole page, bestie!! πβ¨
This one came out of the MPI manual, dated 4/10/2026, and she's filed under MPI_Neighbor_alltoallw_init(3). go forth and make your persistent requests, you absolute icon ππ
π¦ 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