MPI_Ireduce_scatter(3)
β¨ MPI_Ireduce_scatter(3) β the MPI manual, bestie edition β¨
okay so bestie, welcome to MPI_Ireduce_scatter(3) π this one lives in the MPI manual and it is so good once you get it. think of it as reduce + scatter but it hands you back a ticket instead of making you wait. nonblocking, iconic, main character energy π
πΈ NAME πΈ
MPI_Ireduce_scatter β combines values and scatters the results, but make it nonblocking π
π¦ SYNOPSIS π¦
int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf,
const int recvcounts[], MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request)
int MPI_Ireduce_scatter_c(const void *sendbuf, void *recvbuf,
const MPI_Count recvcounts[], MPI_Datatype datatype,
MPI_Op op, MPI_Comm comm, MPI_Request *request)
π INPUT PARAMETERS π
sendbufβ where your send buffer starts, the address of it (choice) π€recvcountsβ a non-negative integer array telling you how many elements of the result get distributed to each process. girly pop, this array must be identical on all calling processes, so no freestyling π ββοΈ (non-negative integer)datatypeβ the data type of the elements chilling in your input buffer (handle) π§opβ the operation you're doing, mmkay (handle) π«commβ the communicator, your little group chat (handle) π«Ά
π OUTPUT PARAMETERS π
recvbufβ where the receive buffer starts, the address of it (choice) π₯requestβ the communication request (handle) π«
π THREAD AND INTERRUPT SAFETY π
This routine is thread-safe, periodt β¨ which means you can literally call it from multiple threads with zero user-provided thread locks, no cap. However, it is not interrupt safe π and the reason is usually that it uses memory allocation routines like malloc, or other non-MPICH runtime routines that themselves aren't interrupt-safe. so like, respect the boundary bestie π
π NOTES FOR FORTRAN π
Every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets a little extra bonus argument called ierr tacked on at the end of the argument list π ierr is an integer and it means exactly the same thing as the return value of the routine in C. also, in Fortran, MPI routines are subroutines, and you invoke them with the call statement, iykyk π
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. that's just how Fortran does it π
π ERRORS π
Every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value β C routines as the value of the function, and Fortran routines in that last argument π«‘ Before the value gets returned, the current MPI error handler is called. By default that error handler aborts the MPI job, so yeah, it's giving dramatic π
The error handler can be swapped out 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 if you want error values to actually come back to you instead. Note that MPI does not guarantee an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible π€
MPI_SUCCESSβ no error, your MPI routine completed successfully, slay βMPI_ERR_ARGβ invalid argument. some argument is invalid and isn't 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 one is using a null communicator in a call (which isn't even allowed inMPI_Comm_rank) πMPI_ERR_COUNTβ invalid count argument. count arguments must be non-negative; a count of zero is often valid, so don't panic about that one π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 thing bestie, go forth and scatter those reduced values nonblockingly, you absolute legend π
this page was served fresh on 4/10/2026 as part of the MPI docs, and it's still called MPI_Ireduce_scatter(3) π
mwah, bye! ππ¦β¨
π¦ 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