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
38
40TEST_F(RepeatEffectUntilTest, works) {
41 const view_s_t data(Kokkos::view_alloc(exec, "data - shared space"));
42
43 const context_t esc{exec};
44
45 auto chain = stdexec::schedule(esc.get_scheduler()) | THEN_INCREMENT(data) | BULK_SUM_INDICES(2, data);
46
47 ASSERT_THAT(
48 recorder_listener_t::record([chain = std::move(chain)]() mutable {
49 unsigned int guard = 0;
50 stdexec::sync_wait(
51 experimental::execution::repeat_until(
52 std::move(chain) | stdexec::continues_on(stdexec::inline_scheduler{})
53 | stdexec::then([&guard]() -> bool { return (++guard) >= 3; })));
54 }),
55 testing::ElementsAre(
64 MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from"))));
65
66 ASSERT_EQ(data(), 6);
67}
68
69} // 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 > 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
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:25
#define BULK_SUM_INDICES(_size_, _data_)
Add a bulk using Tests::Utils::Functors::SumIndices. // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)...