4#include "exec/split.hpp"
5#include "exec/static_thread_pool.hpp"
32using namespace Kokkos::utils::callbacks;
51 stdexec::sender
auto chain = stdexec::schedule(esc.
get_scheduler()) | experimental::execution::split();
61 const view_s_t data(Kokkos::view_alloc(
exec,
"data - shared space"));
63 experimental::execution::static_thread_pool pool{4};
66 stdexec::sender
auto fork = stdexec::schedule(pool.get_scheduler()) | experimental::execution::split();
68 static_assert(!stdexec::dependent_sender<
decltype(fork)>);
77 static_assert(!stdexec::dependent_sender<
decltype(branch_a)>);
78 static_assert(stdexec::dependent_sender<
decltype(branch_b)>);
79 static_assert(!stdexec::dependent_sender<
decltype(branch_c)>);
81 stdexec::sender
auto w_a = stdexec::when_all(std::move(branch_a), std::move(branch_b), std::move(branch_c));
83 static_assert(stdexec::dependent_sender<
decltype(w_a)>);
85 static_assert(std::same_as<
86 stdexec::__completion_domain_of_t<stdexec::set_value_t,
decltype(w_a), stdexec::env<>>,
90 stdexec::sender
auto sndr = std::move(w_a) | stdexec::continues_on(stdexec::inline_scheduler{})
91 | stdexec::then([&data]() { EXPECT_EQ(data(), 5); });
93 static_assert(stdexec::dependent_sender<
decltype(sndr)>);
95 static_assert(std::same_as<
96 stdexec::__completion_domain_of_t<stdexec::set_value_t,
decltype(sndr), stdexec::env<>>,
97 stdexec::default_domain
100 ASSERT_EQ(data(), 0) <<
"Eager execution is not allowed.";
108 ASSERT_THAT(recorded_events, ::testing::SizeIs(8));
112 std::ranges::for_each(
113 recorded_events | std::views::filter([](
const auto& event) ->
bool {
114 return std::holds_alternative<Kokkos::Execution::Impl::RecordEvent>(event);
116 [&](
const auto& event) {
122 testing::UnorderedElementsAre(
131 ASSERT_EQ(data(), 5);
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_BEGIN_FENCE(_exec_, _label_)
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, BeginParallelForEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
#define KOKKOS_EXECUTION_THREADS_THROWS_ON_SYNC_WAIT_ASSERT_AND_SKIP(_sndr_)
#define KOKKOS_EXECUTION_STDEXEC_PRAGMA_DIAGNOSTIC_IGNORED
Basic list of ignored diagnostics when including anything from stdexec.
#define THEN_INCREMENT_ATOMIC(_data_)
Same as THEN_INCREMENT, using Tests::Utils::atomic_add. // NOLINTNEXTLINE(cppcoreguidelines-macro-usa...
auto record_sync_wait(Sndr &&sndr)
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.
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Kokkos::View< value_t, Kokkos::SharedSpace > view_s_t
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t