18 #if !defined(__FLECSI_PRIVATE__) 19 #error Do not include this file directly! 27 #include <type_traits> 31 inline log::devel_tag reduction_wrapper_tag(
"reduction_wrapper");
42 inline MPI_Op reduction_op = (run::context::instance().register_init(
43 detail::register_reduction<R>),
50 template<
typename TYPE>
52 detail::register_reduction() {
53 using value_type =
typename TYPE::LHS;
55 static_assert(std::is_same_v<value_type, typename TYPE::RHS>,
56 "type mismatch: LHS != RHS");
59 log::devel_guard guard(reduction_wrapper_tag);
60 flog(info) <<
"Executing reduction wrapper callback for " 61 << util::type<TYPE>() << std::endl;
66 [](
void * in,
void * inout,
int * len, MPI_Datatype *) {
67 const auto lhs =
static_cast<value_type *
>(inout);
68 const auto rhs =
static_cast<const value_type *
>(in);
70 for(
size_t i{0}; i < *len; ++i) {
71 TYPE::template apply<true>(lhs[i], rhs[i]);
#define flog(severity)
Definition: flog.hh:136
void register_reduction()
Definition: reduction_wrapper.hh:54
Definition: control.hh:31