MPI_Ireduce_scatter_block(3)
π MPI_Ireduce_scatter_block β bestie edition π
okay so this is the MPI_Ireduce_scatter_block(3) page, straight out of the MPI manual, and we're about to make it make sense. no cap.
β¨ NAME β¨
MPI_Ireduce_scatter_block β combines values and scatters the results in a nonblocking way π¦
like, it does the reduce thing, it does the scatter thing, except it does NOT make you sit there and wait for it. it hands you a request handle and lets you get on with your life. main character energy honestly. π
πΈ SYNOPSIS πΈ
int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
MPI_Request *request)
int MPI_Ireduce_scatter_block_c(const void *sendbuf, void *recvbuf,
MPI_Count recvcount, MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request)
yes there are two of them, the classic one and the _c one with the big MPI_Count count. it's giving β¨optionsβ¨, we love that for us. π
π INPUT PARAMETERS π
sendbufβ starting address of send buffer (choice). where the goods start, bestie.recvcountβ element count per block (non-negative integer). not negative, we do not do negative here πdatatypeβ data type of elements of send and receive buffers (handle)opβ operation (handle)commβ communicator (handle)
π«Ά OUTPUT PARAMETERS π«Ά
recvbufβ starting address of receive buffer (choice). this is where your results land πrequestβ communication request (handle). hold onto this one, you'll need it later to actually finish the thing.
π₯ 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. iconic behavior, truly. β¨
BUT. and this is the important part, babes. it is not interrupt safe. π typically that's because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those? those are not interrupt-safe themselves. so like, the vibe is fine until it isn't. be aware. π
π 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 are invoked with the call statement.
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.
so yeah, Fortran besties get a bonus ierr at the end. it's not extra, it's just how they roll. π
π 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 the last argument. Before the value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job. π
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 β like, we're not mad, we're just disappointed. π
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. π«Ά
here's the error roster, no skips:
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).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_OPβ Invalid operation. MPI operations (objects of typeMPI_Op) must either be one of the predefined operations (e.g.,MPI_SUM) or created withMPI_Op_create.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, you understood it perfectly, slay π
this has been the MPI manual, page dated 4/10/2026, for MPI_Ireduce_scatter_block(3). go forth and reduce-scatter nonblockingly. 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