MPI_Ireduce_scatter_block(3)

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

πŸ’– 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 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_OP β€” Invalid operation. MPI operations (objects of type MPI_Op) must either be one of the predefined operations (e.g., MPI_SUM) or created with MPI_Op_create.
  • 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, 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