KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::internal::mpi_operation_traits< Op, Datatype > Struct Template Reference

Type trait for checking whether a functor is a builtin MPI reduction operation and query corresponding MPI_Op. More...

#include <mpi_ops.hpp>

Static Public Member Functions

static MPI_Op op ()
 get the MPI_Op for a builtin type
 

Static Public Attributes

static constexpr bool is_builtin
 true if the operation defined by Op is a builtin MPI operation for the type Datatype
 
static constexpridentity
 The identity of this operation applied on this datatype.
 

Detailed Description

template<typename Op, typename Datatype>
struct kamping::internal::mpi_operation_traits< Op, Datatype >

Type trait for checking whether a functor is a builtin MPI reduction operation and query corresponding MPI_Op.

Example:

is_builtin_mpi_op<std::plus<>, int>::value // true
is_builtin_mpi_op<std::plus<>, int>::op() // MPI_SUM
is_builtin_mpi_op<std::minus<>, int>::value // false
//is_builtin_mpi_op<std::minus<>, int>::op() // error: fails to compile because op is not defined
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
STL namespace.
static MPI_Op op()
get the MPI_Op for a builtin type
Template Parameters
Optype of the operation
Datatypetype to apply the operation to

Member Function Documentation

◆ op()

get the MPI_Op for a builtin type

This member is only defined if value is true. It can then be used to query the predefined constant of type MPI_OP matching the functor defined by type Op, e.g. returns MPI_SUM if Op is kamping::ops::plus<>.

Returns
the builtin MPI_Op constant

Member Data Documentation

◆ identity

The identity of this operation applied on this datatype.

The identity of a {value, operation} pair is the value for which the following two equation holds:

  • identity operation value = value
  • value operation identity = value

◆ is_builtin

true if the operation defined by Op is a builtin MPI operation for the type Datatype

Note that this is only true if the MPI_Datatype corresponding to the C++ datatype Datatype supports the operation according to the standard. If MPI supports the operation for this type, then this is true for functors defined in kamping::ops and there corresponding type-aliased equivalents in the standard library.


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