kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_repeat_until.cpp
Go to the documentation of this file.
2PRAGMA_DIAGNOSTIC_PUSH
4#include "exec/repeat_until.hpp"
5PRAGMA_DIAGNOSTIC_POP
6
9
11
17
29
31
32using namespace Kokkos::utils::callbacks;
33
46
49 const view_s_t data(Kokkos::view_alloc(exec, "data - shared space"));
50
51 const context_t esc{exec};
52
53 auto chain = stdexec::schedule(esc.get_scheduler()) | THEN_INCREMENT(data) | BULK_SUM_INDICES(2, data);
54
55 ASSERT_THAT(
56 recorder_listener_t::record([chain = std::move(chain)]() mutable {
57 unsigned int guard = 0;
58 stdexec::sync_wait(
59 experimental::execution::repeat_until(
60 std::move(chain) | stdexec::continues_on(stdexec::inline_scheduler{})
61 | stdexec::then([&guard]() -> bool { return (++guard) >= 3; })));
62 }),
63 testing::ElementsAre(
72 MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from"))));
73
74 ASSERT_EQ(data(), 6);
75}
76
77} // namespace Tests::ExecutionSpaceImpl
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_BEGIN_PFOR(_exec_, _label_)
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
#define TEST_CATEGORY(_name_)
Definition category.hpp:10
RecorderListener< EventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, BeginParallelForEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
#define KOKKOS_EXECUTION_STDEXEC_PRAGMA_DIAGNOSTIC_IGNORED
Basic list of ignored diagnostics when including anything from stdexec.
#define THEN_INCREMENT(_data_)
Add a then using Tests::Utils::Functors::Increment that may throw. // NOLINTNEXTLINE(cppcoreguideline...
Definition increment.hpp:59
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:54
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Definition event.hpp:75
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:27
#define BULK_SUM_INDICES(_size_, _data_)
Add a bulk using Tests::Utils::Functors::SumIndices. // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)...