MPI_Iscatterv(3)

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

πŸ’« MPI_Iscatterv(3) β€” the MPI manual, bestie edition πŸ’«

okay so picture this: you've got one big ol' buffer of data sitting on one process, and you need to hand out different chunks of it to everyone in the communicator. That's scatter! And this one? Non-blocking. You get a request handle back and go live your life while it happens. Main character energy fr fr. πŸ¦‹


✨ NAME ✨

MPI_Iscatterv β€” scatters a buffer in parts to all processes in a communicator, in a nonblocking way. no cap, it does not wait for you. πŸ’…


🌸 SYNOPSIS 🌸

int MPI_Iscatterv(const void *sendbuf, const int sendcounts[],
const int displs[], MPI_Datatype sendtype, void *recvbuf,
int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm,
MPI_Request *request)
int MPI_Iscatterv_c(const void *sendbuf, const MPI_Count sendcounts[],
const MPI_Aint displs[], MPI_Datatype sendtype,
void *recvbuf, MPI_Count recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm, MPI_Request *request)
literally two flavors, babes: the regular one and the _c one that takes MPI_Count / MPI_Aint when your counts get big enough to scare the regular ints. πŸ’€

πŸ“₯ INPUT PARAMETERS πŸ“₯

  • sendbuf β€” address of send buffer (choice). it's giving "the motherlode of data, sitting on the root like a queen πŸ‘‘"
  • sendcounts β€” non-negative integer array (of length group size) specifying the number of elements to send to each rank (non-negative integer). one number per rank, bestie, so nobody gets left out πŸ₯Ί
  • displs β€” integer array (of length group size). Entry i specifies the displacement (relative to sendbuf) from which to take the outgoing data to process i (integer). this is your "where does their chunk start" map πŸ—ΊοΈ
  • sendtype β€” data type of send buffer elements (handle)
  • recvcount β€” number of elements in receive buffer (non-negative integer)
  • recvtype β€” data type of receive buffer elements (handle)
  • root β€” rank of sending process (integer). the one doing the giving 🫢
  • comm β€” communicator (handle)

πŸ“€ OUTPUT PARAMETERS πŸ“€

  • recvbuf β€” address of receive buffer (choice). where your lil piece lands πŸ’–
  • request β€” communication request (handle). hold onto this, you'll need it later iykyk ✨

🧡 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 thread locks. slay, no extra work for you. πŸ’…

However β€” and listen, this part matters β€” it is not interrupt safe. Typically this is because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like, threads yes, interrupts no. vibe check passed on one, failed on the other 😭


πŸŽ€ 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're invoked with the call statement. so yes, you call it, you don't call it like a C function, bestie. different rules, same drama. 🧚

All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. everything's just an INTEGER, keep it simple πŸ’œ


🚨 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 that last argument. Before the value is returned, the current MPI error handler gets called. And by default? that error handler aborts the MPI job. so like, not a drill. 😳

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 (we don't do that anymore, babe πŸ™ˆ). 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 like... they'll try. no promises. 🫠

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. ate. πŸ’–
  • MPI_ERR_ARG β€” Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g., MPI_ERR_RANK). rude but ok 😭
  • MPI_ERR_BUFFER β€” Invalid buffer pointer. Usually a null buffer where one is not valid. bestie you forgot the buffer πŸ’€
  • MPI_ERR_COMM β€” Invalid communicator. A common error is to use a null communicator in a call (not even allowed in MPI_Comm_rank). literally not even allowed, periodt.
  • MPI_ERR_COUNT β€” Invalid count argument. Count arguments must be non-negative; a count of zero is often valid.
  • 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 first, queen πŸ‘‘
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

okay that's the whole page fr fr 🌈 stay nonblocking, stay iconic, and remember: MPI_Iscatterv is from the MPI manual, and this lil love letter was stamped 4/10/2026 β€” MPI_Iscatterv(3), signing off, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from