kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
test_scheduler.cpp
Go to the documentation of this file.
1
#include "gtest/gtest.h"
2
3
#include "
kokkos-execution/execution_space.hpp
"
4
5
#include "
tests/utils/category.hpp
"
6
#include "
tests/utils/check_scheduler.hpp
"
7
#include "
tests/utils/execution_space_context.hpp
"
8
22
23
namespace
Tests::ExecutionSpaceImpl
{
24
25
using
execution_space_context_t
=
Kokkos::Execution::ExecutionSpaceContext<TEST_EXECUTION_SPACE>
;
26
using
execution_space_scheduler_t
=
Kokkos::Execution::ExecutionSpaceImpl::Scheduler<TEST_EXECUTION_SPACE>
;
27
using
execution_space_schedule_sender_t
=
typename
execution_space_scheduler_t::Sender;
28
using
execution_space_schedule_sender_attrs_t
=
typename
execution_space_schedule_sender_t::Attributes;
29
31
static_assert
(
Tests::Utils::check_scheduler<execution_space_scheduler_t>
());
32
38
TEST(
TEST_CATEGORY
(Scheduler), round_trip_property) {
39
const
execution_space_context_t
ctx{TEST_EXECUTION_SPACE{}};
40
const
execution_space_scheduler_t
sch = ctx.
get_scheduler
();
41
ASSERT_EQ(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(stdexec::schedule(sch))), sch);
42
}
43
48
consteval
bool
test_scheduler_schedule
() {
49
static_assert
(std::same_as<
50
decltype
(stdexec::schedule(std::declval<const execution_space_scheduler_t&>())),
51
execution_space_schedule_sender_t
52
>);
53
54
return
true
;
55
}
56
57
static_assert
(
test_scheduler_schedule
());
58
63
consteval
bool
test_schedule_sender_attrs
() {
64
static_assert
(std::same_as<
65
stdexec::env_of_t<execution_space_schedule_sender_t>,
66
const
execution_space_schedule_sender_attrs_t
&
67
>);
68
69
return
true
;
70
}
71
72
static_assert
(
test_schedule_sender_attrs
());
73
75
consteval
bool
test_scheduler_queries
() {
76
static_assert
(std::same_as<
77
stdexec::__query_result_t<
78
execution_space_scheduler_t
,
79
stdexec::get_completion_domain_t<stdexec::set_value_t>
80
>,
81
Kokkos::Execution::ExecutionSpaceImpl::Domain
82
>);
83
84
static_assert
(std::same_as<
85
stdexec::__query_result_t<
86
execution_space_scheduler_t
,
87
stdexec::get_completion_scheduler_t<stdexec::set_value_t>
88
>,
89
execution_space_scheduler_t
90
>);
91
92
return
true
;
93
}
94
95
static_assert
(
test_scheduler_queries
());
96
98
consteval
bool
test_schedule_sender_attrs_queries
() {
99
static_assert
(std::same_as<
100
stdexec::__query_result_t<
101
execution_space_schedule_sender_attrs_t
,
102
stdexec::get_completion_scheduler_t<stdexec::set_value_t>
103
>,
104
execution_space_scheduler_t
105
>);
106
107
static_assert
(std::same_as<
108
stdexec::__query_result_t<
109
execution_space_schedule_sender_attrs_t
,
110
stdexec::get_completion_domain_t<stdexec::set_value_t>
111
>,
112
Kokkos::Execution::ExecutionSpaceImpl::Domain
113
>);
114
115
return
true
;
116
}
117
118
static_assert
(
test_schedule_sender_attrs_queries
());
119
121
consteval
bool
test_schedule_sender_completion_signatures
() {
122
constexpr
auto
completions = stdexec::completion_signatures<stdexec::set_value_t()>{};
123
124
static_assert
(stdexec::get_completion_signatures<execution_space_schedule_sender_t>() == completions);
125
126
return
true
;
127
}
128
129
static_assert
(
test_schedule_sender_completion_signatures
());
130
131
}
// namespace Tests::ExecutionSpaceImpl
category.hpp
TEST_CATEGORY
#define TEST_CATEGORY(_name_)
Definition
category.hpp:10
check_scheduler.hpp
execution_space.hpp
execution_space_context.hpp
Tests::ExecutionSpaceImpl
Definition
test_any_sender.cpp:39
Tests::ExecutionSpaceImpl::test_schedule_sender_attrs_queries
consteval bool test_schedule_sender_attrs_queries()
Definition
test_scheduler.cpp:98
Tests::ExecutionSpaceImpl::test_schedule_sender_completion_signatures
consteval bool test_schedule_sender_completion_signatures()
Definition
test_scheduler.cpp:121
Tests::ExecutionSpaceImpl::test_schedule_sender_attrs
consteval bool test_schedule_sender_attrs()
Definition
test_scheduler.cpp:63
Tests::ExecutionSpaceImpl::execution_space_schedule_sender_t
typename execution_space_scheduler_t::Sender execution_space_schedule_sender_t
Definition
test_scheduler.cpp:27
Tests::ExecutionSpaceImpl::execution_space_scheduler_t
Kokkos::Execution::ExecutionSpaceImpl::Scheduler< TEST_EXECUTION_SPACE > execution_space_scheduler_t
Definition
test_scheduler.cpp:26
Tests::ExecutionSpaceImpl::execution_space_context_t
Kokkos::Execution::ExecutionSpaceContext< TEST_EXECUTION_SPACE > execution_space_context_t
Definition
test_scheduler.cpp:25
Tests::ExecutionSpaceImpl::test_scheduler_queries
consteval bool test_scheduler_queries()
Definition
test_scheduler.cpp:75
Tests::ExecutionSpaceImpl::execution_space_schedule_sender_attrs_t
typename execution_space_schedule_sender_t::Attributes execution_space_schedule_sender_attrs_t
Definition
test_scheduler.cpp:28
Tests::ExecutionSpaceImpl::test_scheduler_schedule
consteval bool test_scheduler_schedule()
Definition
test_scheduler.cpp:48
Tests::Utils::check_scheduler
consteval bool check_scheduler()
Check that the given type models the stdexec::scheduler concept.
Definition
check_scheduler.hpp:10
Kokkos::Execution::ExecutionSpaceContext
Execution context using a Kokkos execution space under the hood.
Definition
execution_space.hpp:130
Kokkos::Execution::ExecutionSpaceContext::get_scheduler
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< execution_space >
Definition
execution_space.hpp:141
Kokkos::Execution::ExecutionSpaceImpl::Domain
Definition
domain.hpp:13
Kokkos::Execution::ExecutionSpaceImpl::Scheduler
Scheduler for a Kokkos execution space.
Definition
execution_space.hpp:37
tests
execution_space
test_scheduler.cpp
Generated on
for kokkos-execution by
1.18.0