Skip to content

Commit

Permalink
simplify traits for execution space
Browse files Browse the repository at this point in the history
  • Loading branch information
yasahi-hpc committed Aug 28, 2024
1 parent 6b05084 commit ba76e6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
19 changes: 6 additions & 13 deletions common/src/KokkosFFT_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,11 @@ struct complex_view_type {
using type = Kokkos::View<complex_type*, array_layout_type, ExecutionSpace>;
};

template <typename ExecutionSpace, typename Enable = void>
struct is_AnyHostSpace : std::false_type {};

template <typename ExecutionSpace>
struct is_AnyHostSpace<ExecutionSpace,
std::enable_if_t<Kokkos::SpaceAccessibility<
ExecutionSpace, Kokkos::HostSpace>::accessible>>
: std::true_type {};
struct is_AnyHostSpace
: std::integral_constant<
bool, Kokkos::SpaceAccessibility<ExecutionSpace,
Kokkos::HostSpace>::accessible> {};

/// \brief Helper to check if the ExecutionSpace is one of the enabled
/// HostExecutionSpaces
Expand All @@ -279,13 +276,9 @@ inline constexpr bool is_AnyHostSpace_v =
#if !defined(ENABLE_HOST_AND_DEVICE) && \
(defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \
defined(KOKKOS_ENABLE_SYCL))
template <typename ExecutionSpace, typename Enable = void>
struct is_AllowedSpace : std::false_type {};
template <typename ExecutionSpace>
struct is_AllowedSpace<ExecutionSpace,
std::enable_if_t<std::is_same_v<
ExecutionSpace, Kokkos::DefaultExecutionSpace>>>
: std::true_type {};
struct is_AllowedSpace
: std::is_same<ExecutionSpace, Kokkos::DefaultExecutionSpace> {};
#else
template <typename ExecutionSpace>
struct is_AllowedSpace : std::true_type {};
Expand Down
2 changes: 1 addition & 1 deletion common/unit_test/Test_Traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void test_is_any_host_exec_space() {
#endif
#if defined(KOKKOS_ENABLE_THREADS)
static_assert(KokkosFFT::Impl::is_AnyHostSpace_v<Kokkos::Threads>,
"Kokkos::THREADS must be a HostSpace");
"Kokkos::Threads must be a HostSpace");
#endif
}

Expand Down

0 comments on commit ba76e6b

Please sign in to comment.