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"
5#include "exec/single_thread_context.hpp"
6PRAGMA_DIAGNOSTIC_POP
7
10
12
19
31
33
34using namespace Kokkos::utils::callbacks;
35
49
52 const view_s_t data(Kokkos::view_alloc(exec, "data - shared space"));
53
54 exec::single_thread_context stc{};
55 const context_t esc{exec};
56
57 unsigned int guard = 0;
58
59 auto sndr = experimental::execution::repeat_until(
60 stdexec::schedule(esc.get_scheduler()) | THEN_INCREMENT(data) | BULK_SUM_INDICES(2, data)
61 | stdexec::continues_on(stc.get_scheduler()) | stdexec::then([&guard]() -> bool { return (++guard) >= 3; }));
62
64
65 ASSERT_THAT(
67 testing::ElementsAre(
76 MATCHER_FOR_BEGIN_FENCE(exec, dispatch_label(exec, "schedule_from"))));
77
78 ASSERT_EQ(data(), 6);
79}
80
81} // namespace Tests::ExecutionSpaceImpl
constexpr std::string dispatch_label(const Exec &, const std::string_view label)
Get the dispatch label from Exec and label.
#define MATCHER_FOR_BEGIN_SINGLE(_exec_, _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, BeginSingleEvent, Kokkos::Execution::Impl::RecordEvent, Kokkos::Execution::Impl::WaitEvent > recorder_listener_t
#define KOKKOS_EXECUTION_THREADS_THROWS_ON_SYNC_WAIT_ASSERT_AND_SKIP(_sndr_)
Definition context.hpp:76
#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:64
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< execution_space >
Event to be sent to Kokkos::utils::callbacks::dispatch when calling record.
Definition event.hpp:59
Event to be sent to Kokkos::utils::callbacks::dispatch when calling wait.
Definition event.hpp:80
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition context.hpp:33
#define BULK_SUM_INDICES(_size_, _data_)
Add a bulk using Tests::Utils::Functors::SumIndices. // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)...