kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
test_make_policy.cpp
Go to the documentation of this file.
1
#include "gtest/gtest.h"
2
3
#include "
kokkos-utils/tests/scoped/ExecutionSpace.hpp
"
4
5
#include "
kokkos-execution/impl/make_policy.hpp
"
6
17
18
namespace
Tests::Impl
{
19
20
struct
MakePolicyTest
21
:
public
virtual
testing::Test
22
,
public
Kokkos::utils::tests::scoped::ExecutionSpace
<TEST_EXECUTION_SPACE> { };
23
24
consteval
bool
test_make_policy_result_t
() {
25
static_assert
(
26
std::same_as<
27
Kokkos::Execution::Impl::make_policy_result_t<Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
>,
28
Kokkos::SinglePolicy<TEST_EXECUTION_SPACE>
29
>);
30
31
static_assert
(std::same_as<
32
Kokkos::Execution::Impl::make_policy_result_t
<
33
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
,
34
Kokkos::dims<1>
35
>,
36
Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
37
>);
38
39
static_assert
(std::same_as<
40
Kokkos::Execution::Impl::make_policy_result_t
<
41
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE, Kokkos::IndexType<char>
>,
42
Kokkos::dims<1>
43
>,
44
Kokkos::RangePolicy<TEST_EXECUTION_SPACE, Kokkos::IndexType<char>>
45
>);
46
47
static_assert
(std::same_as<
48
Kokkos::Execution::Impl::make_policy_result_t
<
49
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
,
50
Kokkos::range_slice<size_t, size_t>
51
>,
52
Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
53
>);
54
55
static_assert
(std::same_as<
56
Kokkos::Execution::Impl::make_policy_result_t
<
57
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
,
58
Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
59
>,
60
Kokkos::RangePolicy<TEST_EXECUTION_SPACE>
61
>);
62
63
return
true
;
64
}
65
66
static_assert
(
test_make_policy_result_t
());
67
68
consteval
bool
test_make_policy_noexceptness
() {
69
static_assert
(
noexcept
(
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
{}()));
70
71
return
true
;
72
}
73
74
static_assert
(
test_make_policy_noexceptness
());
75
77
TEST_F(
MakePolicyTest
, execution_space_instance) {
78
const
auto
single_policy =
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
{}(this->
exec
);
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 =
83
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
{}(this->
exec
, Kokkos::dims<1>{10});
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
89
const
auto
policy_update =
Kokkos::Execution::Impl::make_policy_t<TEST_EXECUTION_SPACE>
{}(
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
ExecutionSpace.hpp
make_policy.hpp
Kokkos::Execution::Impl::make_policy_result_t
std::invoke_result_t< const MakePolicy &, Args... > make_policy_result_t
Definition
make_policy.hpp:77
Tests::Impl
Definition
test_compile_time_optional.cpp:16
Tests::Impl::test_make_policy_noexceptness
consteval bool test_make_policy_noexceptness()
Definition
test_make_policy.cpp:68
Tests::Impl::test_make_policy_result_t
consteval bool test_make_policy_result_t()
Definition
test_make_policy.cpp:24
Kokkos::Execution::Impl::make_policy_t
Utility functions that wrap constructors of Kokkos execution policies.
Definition
make_policy.hpp:33
Kokkos::utils::tests::scoped::ExecutionSpace
Kokkos::utils::tests::scoped::ExecutionSpace< TEST_EXECUTION_SPACE >::exec
Exec exec
Tests::Impl::MakePolicyTest
Definition
test_make_policy.cpp:22
tests
impl
test_make_policy.cpp
Generated on
for kokkos-execution by
1.18.0