kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_scoped_region.cpp
Go to the documentation of this file.
3
5
11
23
25
26using namespace Kokkos::utils::callbacks;
27
42
44consteval bool test_sndr_traits() {
45 using schd_sndr_t = typename ScopedRegionTest::schedule_sender_t;
46
47 using scoped_region_sndr_t =
48 decltype(std::declval<schd_sndr_t>() | Kokkos::Execution::Profiling::scoped_region("the name of my nice scoped region", stdexec::then(KOKKOS_LAMBDA(){})));
49
50 static_assert(stdexec::__nothrow_connectable<scoped_region_sndr_t, Tests::Utils::SinkReceiver>);
51
52 return true;
53}
54static_assert(test_sndr_traits());
55
61TEST_F(ScopedRegionTest, many) {
62 const view_s_t data(Kokkos::view_alloc("data - shared space", exec));
63
64 const context_t esc{exec};
65
66 auto sndr = stdexec::schedule(esc.get_scheduler())
68 "the name of my nice scoped region", THEN_INCREMENT(data) | THEN_INCREMENT(data));
69
70 const auto recorded_events = Tests::Utils::record_sync_wait<recorder_listener_t>(std::move(sndr));
71
72 ASSERT_THAT(recorded_events, [&]() {
74 return testing::ElementsAre(
76 MATCHER_FOR_PUSH_REGION("the name of my nice scoped region"),
80 MATCHER_FOR_WAIT_EVENT(recorded_events.at(4)),
83 } else {
84 return testing::ElementsAre(
86 MATCHER_FOR_PUSH_REGION("the name of my nice scoped region"),
92 }
93 }());
94}
95
96} // namespace Tests::ExecutionSpaceImpl
#define MATCHER_FOR_PUSH_REGION(_label_)
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_WAIT_EVENT(_record_event_variant_)
#define MATCHER_FOR_BEGIN_PFOR(_exec_, _label_)
#define MATCHER_FOR_RECORD_EVENT(_exec_)
#define MATCHER_FOR_POP_REGION()
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, BeginParallelForEvent, PushRegionEvent, PopRegionEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
#define THEN_INCREMENT(_data_)
Add a then using Tests::Utils::Functors::Increment that may throw. // NOLINTNEXTLINE(cppcoreguideline...
Definition increment.hpp:35
constexpr Kokkos::Execution::ExecutionSpaceImpl::ScopedRegion scoped_region
consteval bool test_sndr_traits()
Definition test_bulk.cpp:49
auto record_sync_wait(Sndr &&sndr)
Definition sync_wait.hpp:14
Matcher to filter out events that are just noise for tests.
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Definition event.hpp:52
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Definition event.hpp:73
decltype(stdexec::schedule(std::declval< scheduler_t >())) schedule_sender_t
Definition context.hpp:29
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:27