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

RAII handle that creates an MPI_Op from a default-constructible C++ functor. More...

#include <reduce_ops.hpp>

Public Member Functions

 ScopedFunctorOp (Op op)
 Creates an MPI_Op for the given functor.
 
 ScopedFunctorOp (ScopedFunctorOp const &)=delete
 
ScopedFunctorOpoperator= (ScopedFunctorOp const &)=delete
 
 ScopedFunctorOp (ScopedFunctorOp &&)=delete
 
ScopedFunctorOpoperator= (ScopedFunctorOp &&)=delete
 
MPI_Op get () const noexcept
 
operator() (T const &lhs, T const &rhs) const
 Applies the functor to two values.
 

Detailed Description

template<bool is_commutative, typename T, typename Op>
class kamping::types::ScopedFunctorOp< is_commutative, T, Op >

RAII handle that creates an MPI_Op from a default-constructible C++ functor.

Calls MPI_Op_create on construction and MPI_Op_free on destruction. The functor is invoked via MPI_Op_create's callback and must be default-constructible (i.e. stateless or state carried via static variables). For capturing lambdas use ScopedCallbackOp.

Template Parameters
is_commutativeWhether the operation is commutative.
TElement type the functor operates on.
OpFunctor type. Must be default-constructible and callable as T(T const&, T const&).

Member Function Documentation

◆ get()

template<bool is_commutative, typename T , typename Op >
MPI_Op kamping::types::ScopedFunctorOp< is_commutative, T, Op >::get ( ) const
inlinenoexcept
Returns
The underlying MPI_Op. Do not free manually — the destructor does it.

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