1 #ifndef DASH__ALGORITHM__OPERATION_H__ 2 #define DASH__ALGORITHM__OPERATION_H__ 5 #include <dash/Types.h> 41 class ReduceOperation {
42 static constexpr
const dart_operation_t _op = OP;
43 static constexpr
const OpKind _kind = KIND;
48 static constexpr dart_operation_t
53 static constexpr OpKind
65 template<
typename BinaryOperation,
typename =
void>
66 struct dart_reduce_operation
67 :
public std::integral_constant<dart_operation_t, DART_OP_UNDEFINED>
74 template<
typename BinaryOperation>
75 struct dart_reduce_operation<BinaryOperation,
76 typename
std::enable_if<
78 BinaryOperation::op_kind() != dash::internal::OpKind::NOOP &&
82 dash::internal::ReduceOperation<
83 typename BinaryOperation::value_type,
84 BinaryOperation::dart_operation(),
85 BinaryOperation::op_kind(), true>,
86 BinaryOperation>::value>::type>
87 :
public std::integral_constant<dart_operation_t,
88 BinaryOperation::dart_operation()>
110 template<
typename BinaryOperation>
113 dart_operation_t value;
124 template<
typename ValueType >
126 :
public internal::ReduceOperation< ValueType, DART_OP_MIN,
127 dash::internal::OpKind::ARITHMETIC,
128 dash::is_arithmetic<ValueType>::value > {
132 return (lhs < rhs) ? lhs : rhs;
143 template<
typename ValueType >
145 :
public internal::ReduceOperation< ValueType, DART_OP_MAX,
146 dash::internal::OpKind::ARITHMETIC,
147 dash::is_arithmetic<ValueType>::value > {
151 return (lhs > rhs) ? lhs : rhs;
162 template<
typename ValueType >
164 :
public internal::ReduceOperation< ValueType, DART_OP_SUM,
165 dash::internal::OpKind::ARITHMETIC,
166 dash::is_arithmetic<ValueType>::value > {
181 template<
typename ValueType >
183 :
public internal::ReduceOperation< ValueType, DART_OP_PROD,
184 dash::internal::OpKind::ARITHMETIC,
185 dash::is_arithmetic<ValueType>::value > {
200 template<
typename ValueType >
202 :
public internal::ReduceOperation< ValueType, DART_OP_NO_OP,
203 dash::internal::OpKind::NOOP, true > {
217 template<
typename ValueType >
219 :
public internal::ReduceOperation< ValueType, DART_OP_REPLACE,
220 dash::internal::OpKind::NOOP, true > {
234 template<
typename ValueType >
236 :
public internal::ReduceOperation< ValueType, DART_OP_BAND,
237 dash::internal::OpKind::BITWISE, true > {
252 template<
typename ValueType >
254 :
public internal::ReduceOperation< ValueType, DART_OP_BOR,
255 dash::internal::OpKind::BITWISE, true > {
270 template<
typename ValueType >
272 :
public internal::ReduceOperation< ValueType, DART_OP_BXOR,
273 dash::internal::OpKind::BITWISE, true > {
283 #endif // DASH__ALGORITHM__OPERATION_H__
Reduce operands to their sum.
This class is a simple memory pool which holds allocates elements of size ValueType.
Reduce operands with binary OR.
Reduce operands to their maximum value.
Reduce operands with binary AND.
Reduce operands to their product.
Reduce operands with binary XOR.
struct dash::dart_operation ValueType
Reduce operands to their minimum value.
see https://en.cppreference.com/w/cpp/feature_test for recommended feature tests
Query the underlying dart_operation_t for arbitrary binary operations.