MPI_Iscatter(3)
π« 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
ierrtacked onto the end of the argument list π«Ά β the only exceptions areMPI_WTIMEandMPI_WTICK.ierris 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
callstatement. - All MPI objects (e.g.
MPI_Datatype,MPI_Comm) are of typeINTEGERin 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 inMPI_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 uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ Other error; useMPI_Error_stringto 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
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms