MPI_Ineighbor_allgatherv(3)

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

πŸ’– MPI_Ineighbor_allgatherv β€” bestie edition πŸ’–

okay so this is a page from the MPI manual, and it's about MPI_Ineighbor_allgatherv. That's a lot of letters, I know, but stay with me, it's literally just the nonblocking version of MPI_Neighbor_allgatherv πŸ¦‹


✨ NAME ✨

MPI_Ineighbor_allgatherv β€” the nonblocking version of MPI_Neighbor_allgatherv. no cap, that's the whole vibe: same energy, but it doesn't make you wait around for it πŸ‘‘


🌸 SYNOPSIS 🌸

int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount,
MPI_Datatype sendtype, void *recvbuf,
const int recvcounts[], const int displs[],
MPI_Datatype recvtype, MPI_Comm comm,
MPI_Request *request)

int MPI_Ineighbor_allgatherv_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
const MPI_Count recvcounts[],
const MPI_Aint displs[], MPI_Datatype recvtype,
MPI_Comm comm, MPI_Request *request)

yes there are two of them, and yes the _c one is the fancy big-count one πŸŽ€ β€” peep the MPI_Count on sendcount/recvcounts and the MPI_Aint on displs. iconic.


🫢 INPUT PARAMETERS 🫢

  • sendbuf β€” the starting address of your send buffer (choice). where the tea you're sending lives β˜•
  • sendcount β€” how many elements get sent to each neighbor (non-negative integer, bestie, keep it non-negative)
  • sendtype β€” the data type of the send buffer elements (handle)
  • recvcounts β€” a non-negative integer array of length indegree holding how many elements get received from each neighbor (non-negative integer). yes, per-neighbor counts, she's specific πŸ’…
  • displs β€” an integer array of length indegree. entry i says the displacement (relative to recvbuf) at which to drop the incoming data from neighbor i (integer). so like, where neighbor i's stuff gets parked πŸ…ΏοΈ
  • recvtype β€” the data type of the receive buffer elements (handle)
  • comm β€” the communicator, and it's one with a topology structure (handle). topo girlies only 🌈

πŸ’œ OUTPUT PARAMETERS πŸ’œ

  • recvbuf β€” starting address of the receive buffer (choice)
  • request β€” the communication request (handle). hold onto this one, she's your receipt 🧾

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

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, she handles it πŸ’ͺ

But. she is not interrupt safe. and the reason is usually memory allocation stuff β€” think malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, thread-safe yes, interrupt-safe no, write that down πŸ“


πŸŽ€ NOTES FOR FORTRAN πŸŽ€

Every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets one extra argument tacked on at the end called ierr. ierr is an integer and it means the exact same thing as the return value of the routine in C. In Fortran, MPI routines are subroutines and you call them with the call statement.

Also, all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. periodt. πŸ’…


😭 ERRORS 😭

Every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β€” in C it's the value of the function, and in Fortran it's that last argument. Before the value comes back to you, the current MPI error handler gets called. By default, that error handler aborts the MPI job πŸ’€ (dramatic, but that's what it does).

You can swap the error handler with MPI_Comm_set_errhandler (for communicators), MPI_File_set_errhandler (for files), and MPI_Win_set_errhandler (for RMA windows). There's also the MPI-1 routine MPI_Errhandler_set, and you may use it, but its use is deprecated β€” so like, don't, bestie 🚫

There's a predefined error handler called MPI_ERRORS_RETURN that you can use to make error values get returned instead. And note: MPI does not guarantee that an MPI program can keep going after an error. That said, MPI implementations will try to continue whenever they possibly can 🫢

  • MPI_SUCCESS β€” no error, the routine did the thing and it slayed ✨
  • MPI_ERR_ARG β€” invalid argument. some argument is invalid and isn't nailed down by a more specific error class (like MPI_ERR_RANK).
  • MPI_ERR_BUFFER β€” invalid buffer pointer. usually a null buffer in a spot where null is not valid πŸ™ˆ
  • MPI_ERR_COMM β€” invalid communicator. the classic mistake is passing a null communicator into a call (which isn't even allowed in MPI_Comm_rank, so you know it's serious).
  • MPI_ERR_COUNT β€” invalid count argument. count arguments have to be non-negative; and heads up, a count of zero is often valid.
  • MPI_ERR_TYPE β€” invalid datatype argument. bonus: this one can also pop up if you use an uncommitted MPI_Datatype (see MPI_Type_commit) in a communication call.
  • MPI_ERR_OTHER β€” other error; hit up MPI_Error_string to get more info about this error code.

lowkey the whole personality of this page is "nonblocking allgatherv but make it neighborly" and honestly? she ate 🌈

that's the page, bestie β€” go forth and gather from your neighbors without blocking, you've got this πŸ’–πŸŒΈπŸ¦‹

this has been the MPI manual, MPI_Ineighbor_allgatherv page, dated 4/10/2026 β€” mwah, catch you in the next one πŸ‘‘

πŸ“¦ where this page comes from