MPI_Ialltoallw(3)

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

πŸ’– MPI_Ialltoallw(3) πŸ’–

okay bestie, welcome to the MPI manual page for MPI_Ialltoallw, and honestly? she's a main character. This is the nonblocking generalized all-to-all communication routine β€” the one that lets you send different datatypes, different counts, and different displacements to every single partner. Like, everyone gets a custom lil gift basket. No cap. πŸŽ€


✨ NAME ✨

MPI_Ialltoallw β€” Nonblocking generalized all-to-all communication allowing different datatypes, counts, and displacements for each partner. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[],
const int sdispls[], const MPI_Datatype sendtypes[],
void *recvbuf, const int recvcounts[], const int rdispls[],
const MPI_Datatype recvtypes[], MPI_Comm comm,
MPI_Request *request)

int MPI_Ialltoallw_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)

Like, there's the regular one, and then there's MPI_Ialltoallw_c, which is the big-count sibling β€” same vibe, but the counts are MPI_Count and the displacements are MPI_Aint. She's for when your numbers get too big for a plain int, iykyk. πŸ“


🌸 INPUT PARAMETERS 🌸

Every single one of these, okay? Don't skip, I'm watching πŸ‘€

  • sendbuf β€” starting address of send buffer (choice). It's giving "here's where my stuff lives".
  • sendcounts β€” integer array (of length group size) specifying the number of elements to send to each rank (non-negative integer). One entry per bestie. Keep those numbers non-negative, fr fr.
  • sdispls β€” integer array (of length group size). Entry j specifies the displacement in bytes (relative to sendbuf) from which to take the outgoing data destined for process j (integer). Yes bestie, bytes, not elements. Don't get it twisted. 😭
  • sendtypes β€” array of datatypes (of length group size). Entry j specifies the type of data to send to process j (handle). Custom types? We love to see it. πŸ‘‘
  • recvcounts β€” integer array (of length group size) specifying the number of elements that can be received from each rank (non-negative integer).
  • rdispls β€” integer array (of length group size). Entry i specifies the displacement in bytes (relative to recvbuf) at which to place the incoming data from process i (integer).
  • recvtypes β€” array of datatypes (of length group size). Entry i specifies the type of data received from process i (handle).
  • comm β€” communicator (handle). The group chat itself.

πŸ’œ OUTPUT PARAMETERS πŸ’œ

  • recvbuf β€” address of receive buffer (choice).
  • request β€” communication request (handle). Hold onto this one, she's how you find out later if the universe said yes. ⭐

🧚 THREAD AND INTERRUPT SAFETY 🧚

This routine is thread-safe. That means the routine may be safely used by multiple threads without the need for any user-provided thread locks. Slay. πŸ’…

However β€” and this is the part where we all gasp πŸ™ˆ β€” the routine is not interrupt safe. Typically, this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. So yeah. Thread-safe: yes. Interrupt-safe: absolutely not, bestie. Know the difference. ✨


🌈 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 they are invoked with the call statement.

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. So like, no handles, just numbers. It's giving retro but honestly? It works. πŸŽ€


🌟 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. 😭 Dramatic, I know, but that's literally what happens.

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 β€” like, please don't, she's old. 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.

Here's the whole error squad, one by one:

  • 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. 🫠
  • 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. Zero is fine!! Negative is not!! πŸ”₯
  • 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. Commit your types, bestie, I'm begging. πŸ’€
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

okay that's the whole page, no notes, you ate. πŸ“ go forth and all-to-all like the icon you are. and if you ever need to look it up again β€” this one's shipped with MPI and dated 4/10/2026, filed under MPI_Ialltoallw(3). mwah. πŸ’–βœ¨

πŸ“¦ where this page comes from