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}
55
56static_assert(test_scheduler_schedule());
57
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
68static_assert(test_schedule_sender_attrs());
69
71consteval 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>>,
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>>,
81 >);
82
83 return true;
84}
85
86static_assert(test_scheduler_queries());
87
90 static_assert(std::same_as<
91 stdexec::__query_result_t<
93 stdexec::get_completion_scheduler_t<stdexec::set_value_t>
94 >,
96 >);
97
98 static_assert(std::same_as<
99 stdexec::__query_result_t<
101 stdexec::get_completion_domain_t<stdexec::set_value_t>
102 >,
104 >);
105
106 return true;
107}
108
110
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
121
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>,
141 >);
142
144 struct ReceiverWithProp
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>,
153 >);
154
155 return true;
156}
157
158static_assert(test_schedule_sender_opstate());
159
160} // 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:123
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< execution_space >
Definition graph.hpp:134
typename node_helper_t< Exec, Queryables... >::type node_t
Definition get_graph.hpp:80
Scheduler for a Kokkos::Experimental::Graph.
Definition graph.hpp:30
A receiver that can handle all completions and does nothing with them.