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/graph.hpp
"
4
5
#include "
tests/utils/category.hpp
"
6
#include "
tests/utils/check_scheduler.hpp
"
7
#include "
tests/utils/graph_context.hpp
"
8
#include "
tests/utils/sink_receiver.hpp
"
9
23
24
namespace
Tests::GraphImpl
{
25
26
using
graph_context_t
=
Kokkos::Execution::GraphContext<TEST_EXECUTION_SPACE>
;
27
using
graph_scheduler_t
=
Kokkos::Execution::GraphImpl::Scheduler<TEST_EXECUTION_SPACE>
;
28
using
graph_schedule_sender_t
=
typename
graph_scheduler_t::Sender;
29
using
graph_schedule_sender_attrs_t
=
typename
graph_schedule_sender_t::Attributes;
30
32
static_assert
(
Tests::Utils::check_scheduler<graph_scheduler_t>
());
33
39
TEST(
TEST_CATEGORY
(Scheduler), round_trip_property) {
40
const
graph_context_t
ctx{TEST_EXECUTION_SPACE{}};
41
const
graph_scheduler_t
sch = ctx.
get_scheduler
();
42
ASSERT_EQ(stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(stdexec::schedule(sch))), sch);
43
}
44
49
consteval
bool
test_scheduler_schedule
() {
50
static_assert
(
51
std::same_as<decltype(stdexec::schedule(std::declval<const graph_scheduler_t&>())),
graph_schedule_sender_t
>);
52
53
return
true
;
54
}
55
56
static_assert
(
test_scheduler_schedule
());
57
62
consteval
bool
test_schedule_sender_attrs
() {
63
static_assert
(std::same_as<stdexec::env_of_t<graph_schedule_sender_t>,
const
graph_schedule_sender_attrs_t
&>);
64
65
return
true
;
66
}
67
68
static_assert
(
test_schedule_sender_attrs
());
69
71
consteval
bool
test_scheduler_queries
() {
72
static_assert
(std::same_as<
73
stdexec::__query_result_t<graph_scheduler_t, stdexec::get_completion_domain_t<stdexec::set_value_t>>,
74
Kokkos::Execution::GraphImpl::Domain
75
>);
76
77
static_assert
(
78
std::same_as<
79
stdexec::__query_result_t<graph_scheduler_t, stdexec::get_completion_scheduler_t<stdexec::set_value_t>>,
80
graph_scheduler_t
81
>);
82
83
return
true
;
84
}
85
86
static_assert
(
test_scheduler_queries
());
87
89
consteval
bool
test_schedule_sender_attrs_queries
() {
90
static_assert
(std::same_as<
91
stdexec::__query_result_t<
92
graph_schedule_sender_attrs_t
,
93
stdexec::get_completion_scheduler_t<stdexec::set_value_t>
94
>,
95
graph_scheduler_t
96
>);
97
98
static_assert
(std::same_as<
99
stdexec::__query_result_t<
100
graph_schedule_sender_attrs_t
,
101
stdexec::get_completion_domain_t<stdexec::set_value_t>
102
>,
103
Kokkos::Execution::GraphImpl::Domain
104
>);
105
106
return
true
;
107
}
108
109
static_assert
(
test_schedule_sender_attrs_queries
());
110
112
consteval
bool
test_schedule_sender_completion_signatures
() {
113
constexpr
auto
completions = stdexec::completion_signatures<stdexec::set_value_t()>{};
114
115
static_assert
(stdexec::get_completion_signatures<graph_schedule_sender_t>() == completions);
116
117
return
true
;
118
}
119
120
static_assert
(
test_schedule_sender_completion_signatures
());
121
127
consteval
bool
test_schedule_sender_opstate
() {
128
using
node_t =
Kokkos::Execution::GraphImpl::GraphComposition::node_t<TEST_EXECUTION_SPACE>
;
129
130
using
prop_t = stdexec::prop<Kokkos::Execution::GraphImpl::get_node_t, const node_t&>;
131
static_assert
(stdexec::__queryable_with<prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
132
static_assert
(
133
std::same_as<stdexec::__query_result_t<prop_t, Kokkos::Execution::GraphImpl::get_node_t>,
const
node_t&>);
134
136
using
rcvr_without_prop_t =
Tests::Utils::SinkReceiver
;
137
static_assert
(!stdexec::__queryable_with<rcvr_without_prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
138
static_assert
(!stdexec::__queryable_with<
139
stdexec::connect_result_t<graph_schedule_sender_t&&, rcvr_without_prop_t>,
140
Kokkos::Execution::GraphImpl::get_node_t
141
>);
142
144
struct
ReceiverWithProp
145
:
Tests::Utils::SinkReceiver
146
, prop_t { };
147
148
using
rcvr_with_prop_t = ReceiverWithProp;
149
static_assert
(stdexec::__queryable_with<rcvr_with_prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
150
static_assert
(!stdexec::__queryable_with<
151
stdexec::connect_result_t<graph_schedule_sender_t&&, rcvr_with_prop_t>,
152
Kokkos::Execution::GraphImpl::get_node_t
153
>);
154
155
return
true
;
156
}
157
158
static_assert
(
test_schedule_sender_opstate
());
159
160
}
// namespace Tests::GraphImpl
category.hpp
TEST_CATEGORY
#define TEST_CATEGORY(_name_)
Definition
category.hpp:10
check_scheduler.hpp
graph.hpp
graph_context.hpp
Tests::GraphImpl
Definition
events.hpp:8
Tests::GraphImpl::test_schedule_sender_completion_signatures
consteval bool test_schedule_sender_completion_signatures()
Definition
test_scheduler.cpp:112
Tests::GraphImpl::test_schedule_sender_opstate
consteval bool test_schedule_sender_opstate()
Definition
test_scheduler.cpp:127
Tests::GraphImpl::test_schedule_sender_attrs
consteval bool test_schedule_sender_attrs()
Definition
test_scheduler.cpp:62
Tests::GraphImpl::test_schedule_sender_attrs_queries
consteval bool test_schedule_sender_attrs_queries()
Definition
test_scheduler.cpp:89
Tests::GraphImpl::graph_schedule_sender_t
typename graph_scheduler_t::Sender graph_schedule_sender_t
Definition
test_scheduler.cpp:28
Tests::GraphImpl::test_scheduler_schedule
consteval bool test_scheduler_schedule()
Definition
test_scheduler.cpp:49
Tests::GraphImpl::graph_scheduler_t
Kokkos::Execution::GraphImpl::Scheduler< TEST_EXECUTION_SPACE > graph_scheduler_t
Definition
test_scheduler.cpp:27
Tests::GraphImpl::test_scheduler_queries
consteval bool test_scheduler_queries()
Definition
test_scheduler.cpp:71
Tests::GraphImpl::graph_context_t
Kokkos::Execution::GraphContext< TEST_EXECUTION_SPACE > graph_context_t
Definition
test_scheduler.cpp:26
Tests::GraphImpl::graph_schedule_sender_attrs_t
typename graph_schedule_sender_t::Attributes graph_schedule_sender_attrs_t
Definition
test_scheduler.cpp:29
Tests::Utils::check_scheduler
consteval bool check_scheduler()
Check that the given type models the stdexec::scheduler concept.
Definition
check_scheduler.hpp:10
sink_receiver.hpp
Kokkos::Execution::GraphContext
Execution context using Kokkos::Experimental::Graph under the hood.
Definition
graph.hpp:123
Kokkos::Execution::GraphContext::get_scheduler
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< execution_space >
Definition
graph.hpp:134
Kokkos::Execution::GraphImpl::Domain
Definition
domain.hpp:13
Kokkos::Execution::GraphImpl::GraphComposition::node_t
typename node_helper_t< Exec, Queryables... >::type node_t
Definition
get_graph.hpp:80
Kokkos::Execution::GraphImpl::Scheduler
Scheduler for a Kokkos::Experimental::Graph.
Definition
graph.hpp:30
Kokkos::Execution::GraphImpl::get_node_t
Definition
get_node.hpp:13
Tests::Utils::SinkReceiver
A receiver that can handle all completions and does nothing with them.
Definition
sink_receiver.hpp:9
tests
graph
test_scheduler.cpp
Generated on
for kokkos-execution by
1.18.0