5#ifndef IPPL_MPI_OPERATIONS_H
6#define IPPL_MPI_OPERATIONS_H
8#include <Kokkos_Complex.hpp>
58 static std::map<std::pair<std::type_index, std::type_index>, MPI_Op>
mpiOperations;
60 template <
typename CppOpType,
typename Datatype_IfNotTrivial>
78 template <
class Op,
typename Type>
86 std::pair<std::type_index, std::type_index> pear{std::type_index(
typeid(Op)),
87 std::type_index(
typeid(Type))};
102 [](
void* inputBuffer,
void* outputBuffer,
int* len, MPI_Datatype*) {
103 Type* input = (Type*)inputBuffer;
105 Type* output = (Type*)outputBuffer;
107 for (
int i = 0; i < *len; i++) {
109 output[i] += input[i];
112 output[i] =
min(output[i], input[i]);
115 output[i] =
max(output[i], input[i]);
118 output[i] *= input[i];
128#define IPPL_MPI_OP(CppOp, MPIOp) \
129 template <typename Datatype_IfNotTrivial> \
130 struct getMpiOpImpl<CppOp, Datatype_IfNotTrivial> { \
131 constexpr MPI_Op operator()() const noexcept { return MPIOp; } \
134 struct is_ippl_mpi_type<CppOp> : std::true_type {};
205 template <
typename Op,
typename Datatype>
#define IPPL_MPI_OP(CppOp, MPIOp)
KOKKOS_INLINE_FUNCTION Vector< T, Dim > min(const Vector< T, Dim > &a, const Vector< T, Dim > &b)
static std::map< std::pair< std::type_index, std::type_index >, MPI_Op > mpiOperations
Helper struct to distinguish between the four basic associative operation types.
static constexpr binaryOperationKind value
static constexpr binaryOperationKind value
static constexpr binaryOperationKind value
static constexpr binaryOperationKind value
constexpr MPI_Op operator()() const noexcept
Helper struct to look up and store MPI_Op types for custom types and custom operations.
MPI_Op operator()()
Get the MPI_Op for this CppOp + Type combo.