MPI_Ineighbor_alltoall(3)

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

πŸ’– MPI_Ineighbor_alltoall β€” the glow-up edition πŸ’–

okay bestie, pull up a chair, because we're talking about MPI_Ineighbor_alltoall, and it lives in the MPI manual (yes, section 3, the library-functions girlies). This is the nonblocking version of MPI_Neighbor_alltoall β€” same vibe, but it hands you a request instead of making you wait around. main character energy fr fr ✨


✨ NAME ✨

MPI_Ineighbor_alltoall β€” Nonblocking version of MPI_Neighbor_alltoall. πŸ’…


🌸 SYNOPSIS 🌸

int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount,
MPI_Datatype sendtype, void *recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm,
MPI_Request *request)

int MPI_Ineighbor_alltoall_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
MPI_Count recvcount, MPI_Datatype recvtype,
MPI_Comm comm, MPI_Request *request)

no cap, there are two of them β€” the classic one with plain int counts, and the _c one where the counts are MPI_Count so they can be big big big. 🫢


πŸ‘‘ INPUT PARAMETERS πŸ‘‘

  • sendbuf β€” starting address of send buffer (choice). this is where your stuff lives, bestie. πŸŽ€
  • sendcount β€” number of elements sent to each neighbor (non-negative integer). note the per neighbor part β€” this isn't the total, it's what each one gets. πŸ’…
  • sendtype β€” data type of send buffer elements (handle). ✨
  • recvcount β€” number of elements received from each neighbor (non-negative integer). again: each neighbor, not the grand total. πŸ‘‘
  • recvtype β€” data type of receive buffer elements (handle). 🌸
  • comm β€” communicator with topology structure (handle). it's gotta have a topology, iykyk. πŸ¦‹

πŸ’– OUTPUT PARAMETERS πŸ’–

  • recvbuf β€” starting address of receive buffer (choice). where the incoming goodies land. πŸ“
  • request β€” communication request (handle). hold onto this one, because you'll need it to actually find out when this thing is done. ⭐

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

This routine is thread-safe. πŸ’ͺ what that means: multiple threads can use it at the same time and you do not need to bring your own user-provided thread locks. no gatekeeping, no drama. 🫢

but β€” and this is the important part β€” it is not interrupt safe. 😭 typically this is because it uses memory allocation routines like malloc, or other non-MPICH runtime routines that are themselves not interrupt-safe. so like… thread-safe yes, interrupt-safe no. don't get it twisted. πŸ’€


🌈 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. periodt. πŸ’…

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, even the ones that feel like they should be something fancier. πŸ™ˆ


πŸ’€ 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 😳 so like… yeah, she's dramatic by default.

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. ⚠️ 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… it might survive, it might not. vibe check at your own risk. 🌸

here's the full roster of error codes, no skipping, we don't do that here:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. slay! βœ…
  • 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. 0️⃣
  • 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. the catch-all girlie, and honestly MPI_Error_string is your bestie here. πŸ’…

and that's the whole page, babe. written up in the MPI manual, dated 4/10/2026 β€” go forth and alltoall your neighbors, nonblockingly, iconically. πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from