kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_make_policy.cpp
Go to the documentation of this file.
1#include "gtest/gtest.h"
2
4
6
17
18namespace Tests::Impl {
19
21 : public virtual testing::Test
22 , public Kokkos::utils::tests::scoped::ExecutionSpace<TEST_EXECUTION_SPACE> { };
23
24consteval bool test_make_policy_result_t() {
25 static_assert(
26 std::same_as<
28 Kokkos::SinglePolicy<TEST_EXECUTION_SPACE>
29 >);
30
31 static_assert(std::same_as<
34 Kokkos::dims<1>
35 >,
36 Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
37 >);
38
39 static_assert(std::same_as<
42 Kokkos::dims<1>
43 >,
44 Kokkos::RangePolicy<TEST_EXECUTION_SPACE, Kokkos::IndexType<char>>
45 >);
46
47 static_assert(std::same_as<
50 Kokkos::range_slice<size_t, size_t>
51 >,
52 Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
53 >);
54
55 static_assert(std::same_as<
58 Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
59 >,
60 Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
61 >);
62
63 return true;
64}
65
66static_assert(test_make_policy_result_t());
67
70
71 return true;
72}
73
74static_assert(test_make_policy_noexceptness());
75
77TEST_F(MakePolicyTest, execution_space_instance) {
79 static_assert(
80 std::same_as<std::remove_const_t<decltype(single_policy)>, Kokkos::SinglePolicy<TEST_EXECUTION_SPACE>>);
81
82 const auto policy_dims1 =
84 static_assert(std::same_as<std::remove_const_t<decltype(policy_dims1)>, Kokkos::RangePolicy<TEST_EXECUTION_SPACE>>);
85 ASSERT_EQ(policy_dims1.space(), this->exec);
86 ASSERT_EQ(policy_dims1.begin(), 0);
87 ASSERT_EQ(policy_dims1.end(), 10);
88
90 this->exec, Kokkos::RangePolicy<TEST_EXECUTION_SPACE>(this->exec, 0, 10));
91 ASSERT_EQ(policy_update.space(), this->exec);
92}
93
94} // namespace Tests::Impl
std::invoke_result_t< const MakePolicy &, Args... > make_policy_result_t
consteval bool test_make_policy_noexceptness()
consteval bool test_make_policy_result_t()
Utility functions that wrap constructors of Kokkos execution policies.