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
static_assert
(
test_scheduler_schedule
());
56
61
consteval
bool
test_schedule_sender_attrs
() {
62
static_assert
(std::same_as<stdexec::env_of_t<graph_schedule_sender_t>,
const
graph_schedule_sender_attrs_t
&>);
63
64
return
true
;
65
}
66
static_assert
(
test_schedule_sender_attrs
());
67
69
consteval
bool
test_scheduler_queries
() {
70
static_assert
(std::same_as<
71
stdexec::__query_result_t<graph_scheduler_t, stdexec::get_completion_domain_t<stdexec::set_value_t>>,
72
Kokkos::Execution::GraphImpl::Domain
73
>);
74
75
static_assert
(
76
std::same_as<
77
stdexec::__query_result_t<graph_scheduler_t, stdexec::get_completion_scheduler_t<stdexec::set_value_t>>,
78
graph_scheduler_t
79
>);
80
81
return
true
;
82
}
83
static_assert
(
test_scheduler_queries
());
84
86
consteval
bool
test_schedule_sender_attrs_queries
() {
87
static_assert
(std::same_as<
88
stdexec::__query_result_t<
89
graph_schedule_sender_attrs_t
,
90
stdexec::get_completion_scheduler_t<stdexec::set_value_t>
91
>,
92
graph_scheduler_t
93
>);
94
95
static_assert
(std::same_as<
96
stdexec::__query_result_t<
97
graph_schedule_sender_attrs_t
,
98
stdexec::get_completion_domain_t<stdexec::set_value_t>
99
>,
100
Kokkos::Execution::GraphImpl::Domain
101
>);
102
103
return
true
;
104
}
105
static_assert
(
test_schedule_sender_attrs_queries
());
106
108
consteval
bool
test_schedule_sender_completion_signatures
() {
109
constexpr
auto
completions = stdexec::completion_signatures<stdexec::set_value_t()>{};
110
111
static_assert
(stdexec::get_completion_signatures<graph_schedule_sender_t>() == completions);
112
113
return
true
;
114
}
115
static_assert
(
test_schedule_sender_completion_signatures
());
116
118
consteval
bool
test_schedule_sender_opstate
() {
119
using
prop_t = stdexec::prop<
120
Kokkos::Execution::GraphImpl::get_node_t
,
121
const
Kokkos::Execution::GraphImpl::GraphComposition::node_t<TEST_EXECUTION_SPACE>
&
122
>;
123
static_assert
(stdexec::__queryable_with<prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
124
static_assert
(std::same_as<
125
stdexec::__query_result_t<prop_t, Kokkos::Execution::GraphImpl::get_node_t>,
126
const
Kokkos::Execution::GraphImpl::GraphComposition::node_t<TEST_EXECUTION_SPACE>
&
127
>);
128
130
using
rcvr_without_prop_t =
Tests::Utils::SinkReceiver
;
131
static_assert
(!stdexec::__queryable_with<rcvr_without_prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
132
static_assert
(!stdexec::__queryable_with<
133
stdexec::connect_result_t<graph_schedule_sender_t&&, rcvr_without_prop_t>,
134
Kokkos::Execution::GraphImpl::get_node_t
135
>);
136
138
struct
ReceiverWithProp
139
:
Tests::Utils::SinkReceiver
140
, prop_t { };
141
using
rcvr_with_prop_t = ReceiverWithProp;
142
static_assert
(stdexec::__queryable_with<rcvr_with_prop_t, Kokkos::Execution::GraphImpl::get_node_t>);
143
static_assert
(stdexec::__queryable_with<
144
stdexec::connect_result_t<graph_schedule_sender_t&&, rcvr_with_prop_t>,
145
Kokkos::Execution::GraphImpl::get_node_t
146
>);
147
static_assert
(std::same_as<
148
stdexec::__query_result_t<
149
stdexec::connect_result_t<graph_schedule_sender_t&&, rcvr_with_prop_t>,
150
Kokkos::Execution::GraphImpl::get_node_t
151
>,
152
const
Kokkos::Execution::GraphImpl::GraphComposition::node_t<TEST_EXECUTION_SPACE>
&
153
>);
154
155
return
true
;
156
}
157
static_assert
(
test_schedule_sender_opstate
());
158
159
}
// 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:108
Tests::GraphImpl::test_schedule_sender_opstate
consteval bool test_schedule_sender_opstate()
Definition
test_scheduler.cpp:118
Tests::GraphImpl::test_schedule_sender_attrs
consteval bool test_schedule_sender_attrs()
Definition
test_scheduler.cpp:61
Tests::GraphImpl::test_schedule_sender_attrs_queries
consteval bool test_schedule_sender_attrs_queries()
Definition
test_scheduler.cpp:86
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:69
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:125
Kokkos::Execution::GraphContext::get_scheduler
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< Exec >
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:78
Kokkos::Execution::GraphImpl::Scheduler
Scheduler for a Kokkos::Experimental::Graph.
Definition
graph.hpp:24
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