MPI_OP_COMMUTATIVE(3)
π MPI_OP_COMMUTATIVE π
okay bestie, welcome to the Open MPI manual, page MPI_OP_COMMUTATIVE(3) β yes the third section, we're in library-call territory, very demure, very mindful π
β¨ NAME β¨
MPI_Op_commutative β bestie, this is literally just a vibe check for your reduction operation. You're asking: is this op commutative or not? That's it. That's the whole function. π¦
β¨ SYNTAX β¨
π C Syntax
#include <mpi.h>
int MPI_Op_commutative(MPI_Op op, int *commute)
π Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_OP_COMMUTATIVE(OP, COMMUTE, IERROR)
LOGICAL COMMUTE
INTEGER OP, IERROR
π Fortran 2008 Syntax
USE mpi_f08
MPI_Op_commutative(op, commute, ierror)
TYPE(MPI_Op), INTENT(IN) :: op
INTEGER, INTENT(OUT) :: commute
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
β¨ INPUT PARAMETER β¨
opβ the operation, as a handle. That's the thing you're interrogating. π
β¨ OUTPUT PARAMETERS β¨
commuteβtrueifopis commutative,falseif it's not. Logical, periodt. πierrorβ Fortran only, babes: the error status, an integer. π
β¨ DESCRIPTION β¨
Reduction operations can be queried for their commutativity. That's the plot. You hand over an op, it tells you whether it commutes. slay π
β¨ ERRORS β¨
ngl, here's where it gets real β almost every MPI routine gives you back an error value. C routines? That's the return result of the function. Fortran routines? It's the last argument. πΈ
Before the error value comes back to you, the current MPI error handler that's attached to the communication object (think: communicator, window, file) gets called. And if no communication object is tied to the MPI call at all, then the call is considered attached to MPI_COMM_SELF and it'll call the error handler associated with that. Now β when MPI_COMM_SELF is not initialized (aka before MPI_Init / MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively), the error raises the initial error handler instead. You can swap out that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're in the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or with the info key to MPI_Comm_spawn / MPI_Comm_spawn_multiple. And if literally no other appropriate error handler has been set? Then the MPI_ERRORS_RETURN handler gets called for MPI I/O functions, and MPI_ERRORS_ABORT gets called for all the other MPI functions. π
Open MPI ships three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yeah. everyone. πMPI_ERRORS_ABORTβ an error handler you can invoke on a communicator, window, file, or session. Called on a communicator, it acts as ifMPI_Abortwas called on that communicator. Called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. Called on a session, it aborts only the local process.MPI_ERRORS_RETURNβ returns an error code back to your application. chill of it honestly. π«Ά
Your MPI application can also implement its own error handlers by calling:
MPI_Comm_create_errhandlerand thenMPI_Comm_set_errhandlerMPI_File_create_errhandlerand thenMPI_File_set_errhandlerMPI_Session_create_errhandlerand thenMPI_Session_set_errhandler, or atMPI_Session_initMPI_Win_create_errhandlerand thenMPI_Win_set_errhandler
β οΈ Heads up bestie: note that MPI does not guarantee that an MPI program can continue past an error. Like, at all. Do not make plans after this error. π¨
See the MPI man page for a full list of MPI error codes.
See the Error Handling section of the MPI-3.1 standard for more information.
See also:
MPI_Op_create
β¨ Copyright β¨
2003-2026, The Open MPI Community
and that's the whole page, no cap π thanks for reading my little manual moment β this was the Open MPI MPI_OP_COMMUTATIVE(3) page, version dated Sep 10, 2026, footer and all, and you ate it up fr fr β¨ππ¦
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms