Skip to content

Commit

Permalink
Fix reducer result check for Serial+HPX ParallelReduce
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Mar 2, 2023
1 parent 569a609 commit 79f8144
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
21 changes: 18 additions & 3 deletions core/src/HPX/Kokkos_HPX.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,12 @@ class ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>,
: m_functor_reducer(arg_functor_reducer),
m_policy(arg_policy),
m_result_ptr(arg_view.data()),
m_force_synchronous(!arg_view.impl_track().has_record()) {}
m_force_synchronous(!arg_view.impl_track().has_record()) {
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"HPX reduce result must be a View accessible from HostSpace");
}
};

template <class CombinedFunctorReducerType, class... Traits>
Expand Down Expand Up @@ -1183,7 +1188,12 @@ class ParallelReduce<CombinedFunctorReducerType,
m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)),
m_functor_reducer(arg_functor_reducer),
m_result_ptr(arg_view.data()),
m_force_synchronous(!arg_view.impl_track().has_record()) {}
m_force_synchronous(!arg_view.impl_track().has_record()) {
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"HPX reduce result must be a View accessible from HostSpace");
}

template <typename Policy, typename Functor>
static int max_tile_size_product(const Policy &, const Functor &) {
Expand Down Expand Up @@ -1586,7 +1596,12 @@ class ParallelReduce<CombinedFunctorReducerType,
m_shared(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) +
FunctorTeamShmemSize<FunctorType>::value(
m_functor_reducer.get_functor(), arg_policy.team_size())),
m_force_synchronous(!arg_result.impl_track().has_record()) {}
m_force_synchronous(!arg_result.impl_track().has_record()) {
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"HPX reduce result must be a View accessible from HostSpace");
}
};
} // namespace Impl
} // namespace Kokkos
Expand Down
3 changes: 2 additions & 1 deletion core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class ParallelReduce<CombinedFunctorReducerType,
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"Kokkos::Serial reduce result must be a View in HostSpace");
"Kokkos::Serial reduce result must be a View accessible from "
"HostSpace");
}
};

Expand Down
3 changes: 2 additions & 1 deletion core/src/Serial/Kokkos_Serial_Parallel_Range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class ParallelReduce<CombinedFunctorReducerType, Kokkos::RangePolicy<Traits...>,
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"Kokkos::Serial reduce result must be a View in HostSpace");
"Kokkos::Serial reduce result must be a View accessible from "
"HostSpace");
}
};

Expand Down
2 changes: 1 addition & 1 deletion core/src/Serial/Kokkos_Serial_Parallel_Team.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class ParallelReduce<CombinedFunctorReducerType,
static_assert(
Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space,
Kokkos::HostSpace>::accessible,
"Reduction result on Kokkos::Serial must be a Kokkos::View in "
"Kokkos::Serial reduce result must be a View accessible from "
"HostSpace");
}
};
Expand Down

0 comments on commit 79f8144

Please sign in to comment.