kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_scheduler.cpp
Go to the documentation of this file.
1#include "gtest/gtest.h"
2
4
9
23
24namespace Tests::GraphImpl {
25
28using graph_schedule_sender_t = typename graph_scheduler_t::Sender;
29using graph_schedule_sender_attrs_t = typename graph_schedule_sender_t::Attributes;
30
33
39TEST(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
49consteval 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}
55static_assert(test_scheduler_schedule());
56
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}
66static_assert(test_schedule_sender_attrs());
67
69consteval 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>>,
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>>,
79 >);
80
81 return true;
82}
83static_assert(test_scheduler_queries());
84
87 static_assert(std::same_as<
88 stdexec::__query_result_t<
90 stdexec::get_completion_scheduler_t<stdexec::set_value_t>
91 >,
93 >);
94
95 static_assert(std::same_as<
96 stdexec::__query_result_t<
98 stdexec::get_completion_domain_t<stdexec::set_value_t>
99 >,
101 >);
102
103 return true;
104}
106
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}
116
119 using prop_t = stdexec::prop<
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>,
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>,
135 >);
136
138 struct ReceiverWithProp
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>,
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>,
151 >,
153 >);
154
155 return true;
156}
157static_assert(test_schedule_sender_opstate());
158
159} // namespace Tests::GraphImpl
#define TEST_CATEGORY(_name_)
Definition category.hpp:10
consteval bool test_schedule_sender_completion_signatures()
consteval bool test_schedule_sender_opstate()
consteval bool test_schedule_sender_attrs()
consteval bool test_schedule_sender_attrs_queries()
typename graph_scheduler_t::Sender graph_schedule_sender_t
consteval bool test_scheduler_schedule()
Kokkos::Execution::GraphImpl::Scheduler< TEST_EXECUTION_SPACE > graph_scheduler_t
consteval bool test_scheduler_queries()
Kokkos::Execution::GraphContext< TEST_EXECUTION_SPACE > graph_context_t
typename graph_schedule_sender_t::Attributes graph_schedule_sender_attrs_t
consteval bool check_scheduler()
Check that the given type models the stdexec::scheduler concept.
Execution context using Kokkos::Experimental::Graph under the hood.
Definition graph.hpp:125
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< Exec >
Definition graph.hpp:134
typename node_helper_t< Exec, Queryables... >::type node_t
Definition get_graph.hpp:78
Scheduler for a Kokkos::Experimental::Graph.
Definition graph.hpp:24
A receiver that can handle all completions and does nothing with them.