MPI_Reduce_local(3)

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

πŸ’– MPI_Reduce_local(3) πŸ’–

okay bestie, welcome to the MPI manual, page MPI_Reduce_local(3) β€” this is the glow-up arc of MPI_Reduce where there's no comm, no ranks, no drama, just you and your own buffers. πŸ¦‹


✨ NAME ✨

MPI_Reduce_local β€” Applies a reduction operator to local arguments. πŸŽ€


🌸 SYNOPSIS 🌸

int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count,
MPI_Datatype datatype, MPI_Op op)

int MPI_Reduce_local_c(const void *inbuf, void *inoutbuf, MPI_Count count,
MPI_Datatype datatype, MPI_Op op)

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • inbuf β€” input buffer (choice). the one you're bringing to the party πŸ’…
  • count β€” number of elements in inbuf and inoutbuf buffers (non-negative integer). no negative counts, that's not the vibe 🚫
  • datatype β€” data type of elements of inbuf and inoutbuf buffers (handle). it's giving type info ✨
  • op β€” operation (handle). your reduction operator, the main character of the reduction 🌟

πŸ’œ INPUT/OUTPUT PARAMETERS πŸ’œ

  • inoutbuf β€” combined input and output buffer (choice). she does both jobs, iconic behavior honestly πŸ‘‘

😭 NOTES ON COLLECTIVE OPERATIONS 😭

The reduction functions ( MPI_Op ) do not return an error value. so yeah β€” if they catch an error, all they can do is either call MPI_Abort or silently skip the problem. so if you switch your error handler from MPI_ERRORS_ARE_FATAL to literally anything else β€” say, MPI_ERRORS_RETURN β€” then no error may be indicated. πŸ’€ ghosted by your own error reporting, fr fr.

The reason for this? performance problems in ensuring that all collective routines return the same error value. not a vibe decision, just a performance one 🫠


🧚 THREAD AND INTERRUPT SAFETY 🧚

This routine is thread-safe. that means you can safely use it from multiple threads with zero user-provided thread locks needed, no cap. 🧡✨

However, the routine is not interrupt safe. typically this is due to the use of memory allocation routines such as malloc or other non-MPICH runtime routines that are themselves not interrupt-safe. so like… threads yes, interrupts no. she has boundaries πŸ’…


🌈 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 they get invoked with the call statement. πŸŽ€

All MPI objects (e.g., MPI_Datatype , MPI_Comm ) are of type INTEGER in Fortran. periodt. πŸ’–


πŸ”₯ 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 🚩 β€” lowkey don't. 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. 🫢

  • MPI_SUCCESS β€” No error; MPI routine completed successfully. slay βœ…
  • MPI_ERR_BUFFER β€” Invalid buffer pointer. Usually a null buffer where one is not valid. bestie that pointer is nothing 😭
  • 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. commit your types, girl πŸ’…
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code. the mystery box πŸ“¦βœ¨

ngl, MPI_Reduce_local is basically MPI_Reduce but keeping it all to yourself β€” no communication, just vibes. same datatype rules, same op rules, same caveats. iykyk. πŸ’–

that's the whole page, babe β€” you ate it, fr fr. πŸ“ this lil masterpiece is dated 4/10/2026 and it belongs to MPI_Reduce_local(3) from the MPI manual. go forth and reduce locally, queen. πŸŒΈπŸ’œβœ¨

πŸ“¦ where this page comes from