MPI_Scatter_init(3)
π MPI_Scatter_init(3) π
okay bestie, welcome to the MPI corner of the manual β this one's about MPI_Scatter_init, and yes it's exactly as iconic as it sounds π
β¨ NAME β¨
MPI_Scatter_init β Create a persistent request for scatter.
that's the whole vibe. a scatter, but make it persistent. periodt π
πΈ SYNOPSIS πΈ
int MPI_Scatter_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm, MPI_Info info,
MPI_Request *request)
int MPI_Scatter_init_c(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype, void *recvbuf,
MPI_Count recvcount, MPI_Datatype recvtype, int root,
MPI_Comm comm, MPI_Info info, MPI_Request *request)
two flavors, same energy π β the regular one and the _c one that takes MPI_Count for the counts.
π«Ά INPUT PARAMETERS π«Ά
sendbufβ address of send buffer (choice)sendcountβ number of elements sent to each process (non-negative integer)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)commβ communicator (handle)infoβ info argument (handle)
π OUTPUT PARAMETERS π
recvbufβ address of receive buffer (choice)requestβ communication request (handle)
π§΅ THREAD AND INTERRUPT SAFETY π§΅
lowkey good news first: this routine is thread-safe. meaning you can hit it from multiple threads with zero user-provided thread locks and she's fine β¨
but (and this is the important part, bestie) it is not interrupt safe π typically that's because of memory allocation routines like malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like. keep that in mind, ok?
π NOTES FOR FORTRAN π
- every MPI routine in Fortran (except
MPI_WTIMEandMPI_WTICK) gets an extra argument calledierrtacked onto the end of the argument list.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. yes, really, that's the whole thing. - all MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran π
π ERRORS π
so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines give it back as the value of the function, Fortran routines put it in that last argument. before the value comes back, the current MPI error handler gets called. by default, that error handler aborts the MPI job π³ (dramatic but true).
you can change 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 β οΈ. 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β¦ bestie, don't count on it π«
MPI_SUCCESSβ No error; MPI routine completed successfully. slay π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_INFOβ Invalid InfoMPI_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, no cap π go forth and scatter, main character πβ¨
MPI Β· 4/10/2026 Β· MPI_Scatter_init(3) β k bye bestie, ily, see u in the next manpage π¦π
π¦ 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