MPI_Iscatter(3)

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

πŸ’« MPI_Iscatter β€” from the MPI manual, section 3 (3) πŸ’«

okay bestie, gather round 🫢 this is MPI_Iscatter, straight outta the MPI manual (section 3, the one you flip to when you're feeling fancy). It's the ✨nonblocking✨ sibling of scatter: one process yeets data out to all the other processes in a communicator, but it does NOT make you sit there and wait. Iconic. πŸ‘‘


🌸 NAME 🌸

MPI_Iscatter β€” Sends data from one process to all other processes in a communicator in a nonblocking way πŸ’…


✨ SYNOPSIS ✨

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

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

🌈 INPUT PARAMETERS 🌈

like, everything you gotta hand over before the magic happens:

  • sendbuf β€” address of send buffer (choice). this is the pile of stuff being handed out πŸ“¦
  • sendcount β€” number of elements sent to each process (non-negative integer). so like, per-process portion, bestie.
  • 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 main character of this operation πŸ‘‘
  • comm β€” communicator (handle)

πŸŽ€ OUTPUT PARAMETERS πŸŽ€

what you get back, no cap:

  • recvbuf β€” address of receive buffer (choice)
  • request β€” communication request (handle). hold onto this one, you'll need it later fr fr 🫢

πŸ’œ THREAD AND INTERRUPT SAFETY πŸ’œ

okay so the tea: this routine is thread-safe ✨. That means multiple threads can use it at the same time and you do not have to bring your own thread locks β€” it handles all that. slay.

BUT. and this is a big but 😭 β€” the routine is not interrupt safe. Typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines, and those routines are themselves not interrupt-safe. So like… it's giving "trust me but only so far". πŸ’€


πŸ¦‹ NOTES FOR FORTRAN πŸ¦‹

  • Every MPI routine in Fortran has an extra argument ierr tacked onto the end of the argument list 🫢 β€” the only exceptions are MPI_WTIME and MPI_WTICK. 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 invoke them with the call statement.
  • All MPI objects (e.g. MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. no notes, that's just how it is πŸ’…

😭 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 comes back, the current MPI error handler gets called.

⚠️ By default, this error handler aborts the MPI job. Like, the whole thing. gone. πŸ’€

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). The MPI-1 routine MPI_Errhandler_set may be used, but its use is deprecated πŸ™ˆ β€” don't do it, bestie.

The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.

πŸ“Œ Note: MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible.

🌟 the error codes, one by one 🌟

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. we love to see it πŸŽ‰
  • 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.
  • 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.

and that's the whole page, bestie 🌈 every flag, every handle, every error code, every caveat β€” all of it, preserved like a lil museum exhibit πŸ’– go forth and scatter (nonblockingly) 🧚

signing off from the MPI manual, this was MPI_Iscatter(3), dated 4/10/2026 β€” periodt πŸ’…β­

πŸ“¦ where this page comes from