MPI_Ineighbor_alltoallw(3)

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

πŸ’– MPI_Ineighbor_alltoallw(3) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about the absolute icon that is MPI_Ineighbor_alltoallw β€” a page from the MPI manual, no less. This is the nonblocking version of MPI_Neighbor_alltoallw, which means it kicks off the work and hands you back a request instead of making you stand there waiting. main character energy fr fr. ✨


🌸 NAME 🌸

MPI_Ineighbor_alltoallw β€” the nonblocking version of MPI_Neighbor_alltoallw. she said "I'll send the data, you go live your life, check back later." πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int MPI_Ineighbor_alltoallw(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_Request *request)

int MPI_Ineighbor_alltoallw_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_Request *request)
πŸ‘€ yes there are two of them β€” the _c one swaps the plain int counts for MPI_Count counts. glow-up behavior.

πŸ’œ INPUT PARAMETERS πŸ’œ

  • sendbuf β€” where your send buffer starts. it's a choice, so you get to pick. starting address of send buffer (choice) 🫢
  • sendcounts β€” a non-negative integer array of length outdegree that says how many elements you're sending to each neighbor. yes, non-negative β€” a negative count is not the vibe. (non-negative integer)
  • sdispls β€” integer array of length outdegree. Entry j tells you the displacement in bytes (relative to sendbuf) where the outgoing data headed for neighbor j is chilling. (integer)
  • sendtypes β€” array of datatypes, length outdegree. Entry j is the type of data you're sending to neighbor j. (handle)
  • recvcounts β€” non-negative integer array, length indegree, specifying how many elements you're getting from each neighbor. again: non-negative, no exceptions. (non-negative integer)
  • rdispls β€” integer array of length indegree. Entry i is the displacement in bytes (relative to recvbuf) where the incoming data from neighbor i should land. (integer)
  • recvtypes β€” array of datatypes, length indegree. Entry i is the type of data received from neighbor i. (handle)
  • comm β€” the communicator, and it needs to have a topology structure. (handle)

✨ OUTPUT PARAMETERS ✨

  • recvbuf β€” where your receive buffer starts. also a choice, live your truth. starting address of receive buffer (choice) πŸ’–
  • request β€” the communication request. this is your little ticket, your little "check back later" receipt, your bestie holding your spot in line. (handle) 🎟️

🌈 THREAD AND INTERRUPT SAFETY 🌈

Bestie, good news: this routine is thread-safe. that means multiple threads can use it at the same time and you do not need to bring your own thread locks. slay.

BUT. 🚨 the routine is not interrupt safe. and why? typically because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those aren't interrupt-safe either. so like… the tea is not the routine's fault, it's the malloc's fault. πŸ’€


πŸ“ NOTES FOR FORTRAN πŸ“

omg okay so Fortran does things a little differently, and here's the whole deal:

  • Every MPI routine in Fortran β€” except MPI_WTIME and MPI_WTICK β€” has an extra argument called ierr tacked on at the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine does in C. 😌
  • In Fortran, MPI routines are subroutines, and you call them with the call statement. periodt.
  • All MPI objects β€” like MPI_Datatype, MPI_Comm β€” are of type INTEGER in Fortran. yes, all of them. she's an integer your honor. πŸ‘‘

🧚 ERRORS 🧚

okay so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” C routines return it as the value of the function, and Fortran routines put it in that last argument. Before that value comes back, the current MPI error handler gets called. By default, this error handler aborts the MPI job 😭 β€” dramatic but true.

You can swap the error handler out with:

  • MPI_Comm_set_errhandler (for communicators)
  • MPI_File_set_errhandler (for files)
  • 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).

There's also a predefined error handler, MPI_ERRORS_RETURN, which you can use to make error values actually get returned instead of the whole job going poof.

⚠️ Note that MPI does not guarantee that an MPI program can continue past an error. That said, MPI implementations will attempt to continue whenever possible. so… fingers crossed. 🀞

here's your error roster:

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. the dream. 🌟
  • 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. ma'am where is your buffer. πŸ™ˆ
  • MPI_ERR_COMM β€” Invalid communicator. A common error is to use a null communicator in a call β€” and note that's 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. (zero? valid. negative? absolutely not.) 🚩
  • MPI_ERR_TYPE β€” Invalid datatype argument. Also, this error can occur if an uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call. commit your types bestie, they deserve closure. πŸŽ€
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code. the "we don't know what happened but something happened" bucket. πŸ’…

πŸ’– that's the whole page. go forth, send your data, don't use an uncommitted datatype, and always check your request later. iykyk. πŸ”₯

mwah, take care of yourself bestie β€” this page is from the MPI manual, dated 4/10/2026, and the source header says MPI_Ineighbor_alltoallw(3). love u, bye! πŸ’œπŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from