Skip to content

Commit

Permalink
Use macros to protect use of SharedSpace
Browse files Browse the repository at this point in the history
if constexpr protection is not enough, false branches still need to be
parsable.
  • Loading branch information
crtrott committed Aug 21, 2024
1 parent 46d2349 commit a8d7640
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/unit_test/TestViewBadAlloc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,17 @@ TEST(TEST_CATEGORY, view_bad_alloc) {

test_view_bad_alloc<MemorySpace>();

#if !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET)
constexpr bool execution_space_is_device =
std::is_same_v<ExecutionSpace, Kokkos::DefaultExecutionSpace> &&
!std::is_same_v<Kokkos::DefaultExecutionSpace,
Kokkos::DefaultHostExecutionSpace>;

if constexpr (execution_space_is_device) {
if constexpr (Kokkos::has_shared_space) {
test_view_bad_alloc<Kokkos::SharedSpace>();
}
if constexpr (Kokkos::has_shared_host_pinned_space) {
test_view_bad_alloc<Kokkos::SharedHostPinnedSpace>();
}
test_view_bad_alloc<Kokkos::SharedSpace>();
test_view_bad_alloc<Kokkos::SharedHostPinnedSpace>();
}
#endif
}

} // namespace

0 comments on commit a8d7640

Please sign in to comment.