KaMPIng 0.2.1
(Near) zero-overhead MPI wrapper for C++
Loading...
Searching...
No Matches
kamping::internal::ReduceOperation< T, Op, Commutative > Class Template Reference

Wraps an operation and translates it to a builtin MPI_Op or constructs a custom operation. More...

#include <mpi_ops.hpp>

Public Member Functions

 ReduceOperation (Op &&op, Commutative commutative)
 Constructs an operation wrapper.
 
MPI_Op op ()
 
operator() (T const &lhs, T const &rhs) const
 Call the underlying operation with the provided arguments.
 
identity ()
 Returns the identity element for this operation and data type.
 

Static Public Attributes

static constexpr bool is_builtin
 True if this is a predefined MPI operation.
 
static constexpr bool commutative
 True if the operation is commutative.
 

Detailed Description

template<typename T, typename Op, typename Commutative>
class kamping::internal::ReduceOperation< T, Op, Commutative >

Wraps an operation and translates it to a builtin MPI_Op or constructs a custom operation.

Template Parameters
Tthe argument type of the operation
Opthe type of the operation
Commutativetag indicating if this type is commutative

Constructor & Destructor Documentation

◆ ReduceOperation()

kamping::internal::ReduceOperation< T, Op, Commutative >::ReduceOperation ( Op && op,
Commutative commutative )

Constructs an operation wrapper.

Parameters
opthe operation (function object, lambda, or std::function)
commutativecommutativity tag (kamping::ops::commutative or kamping::ops::non_commutative)

Member Function Documentation

◆ identity()

Returns the identity element for this operation and data type.

Only available when is_builtin == true. For custom operations this member does not exist; callers must guard with if constexpr (operation.is_builtin).

◆ op()

Returns
the MPI_Op associated with this operation.

The documentation for this class was generated from the following file: