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
14
26
28
29using namespace Kokkos::utils::callbacks;
30
43
45TEST_F(RepeatEffectUntilTest, works) {
46 const view_s_t data(Kokkos::view_alloc(exec, "data - shared space"));
47
48 const context_t esc{exec};
49
50 auto chain = stdexec::schedule(esc.get_scheduler()) | THEN_INCREMENT(data) | BULK_SUM_INDICES(2, data);
51
52 ASSERT_THAT(
53 recorder_listener_t::record([chain = std::move(chain)]() mutable {
54 unsigned int guard = 0;
55 stdexec::sync_wait(
56 experimental::execution::repeat_until(
57 std::move(chain) | stdexec::continues_on(stdexec::inline_scheduler{})
58 | stdexec::then([&guard]() -> bool { return (++guard) >= 3; })));
59 }),
60 testing::ElementsAre(
69 MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from"))));
70
71 ASSERT_EQ(data(), 6);
72}
73
74} // 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_)
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:35
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
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)...