kokkos-execution 0.0.1
Loading...
Searching...
No Matches
test_check_scheduler_type.cpp
Go to the documentation of this file.
1#include "gtest/gtest.h"
2
4PRAGMA_DIAGNOSTIC_PUSH
6#include "exec/split.hpp"
7#include "exec/static_thread_pool.hpp"
8PRAGMA_DIAGNOSTIC_POP
9
11
14
25
26namespace Tests {
27
28using run_loop_scheduler_t = stdexec::run_loop::scheduler;
29using static_thread_pool_scheduler_t = experimental::execution::_pool_::_static_thread_pool::scheduler;
30
32TEST(check_scheduler, default) {
33 stdexec::sync_wait(
36}
37
39TEST(check_scheduler, static_thread_pool) {
40 experimental::execution::static_thread_pool pool{1};
41
42 auto chain = stdexec::schedule(pool.get_scheduler())
45
46 stdexec::sync_wait(std::move(chain)); // NOLINT(performance-move-const-arg)
47}
48
54TEST(check_scheduler, split_when_all_no_forward) {
55 experimental::execution::static_thread_pool pool{1};
56
57 auto fork = stdexec::schedule(pool.get_scheduler())
59 | THEN_SHOW_THREAD_ID | experimental::execution::split();
60
61 auto chain = stdexec::when_all(
64
65 stdexec::sync_wait(
67}
68
74TEST(check_scheduler, split_transfer_when_all_no_forward) {
75 ::exec::static_thread_pool pool{1};
76
77 auto fork = stdexec::schedule(pool.get_scheduler())
79 | THEN_SHOW_THREAD_ID | experimental::execution::split();
80
81 auto chain = stdexec::transfer_when_all(
82 pool.get_scheduler(),
85
86 stdexec::sync_wait(
88}
89
91TEST(check_scheduler, multiple_splits) {
92 ::exec::static_thread_pool pool{1};
93
94 auto fork_A = stdexec::schedule(pool.get_scheduler())
96 | THEN_SHOW_THREAD_ID | experimental::execution::split();
97
98 auto chain_A_branch_a = fork_A | THEN_SHOW_THREAD_ID;
99 auto chain_A_branch_b = std::move(fork_A) | THEN_SHOW_THREAD_ID;
100
101 auto chain_A = stdexec::when_all(std::move(chain_A_branch_a), std::move(chain_A_branch_b)) | THEN_SHOW_THREAD_ID;
102
103 auto fork_B = std::move(chain_A) | stdexec::continues_on(pool.get_scheduler())
105 | experimental::execution::split();
106
107 auto chain_B_branch_a = fork_B | THEN_SHOW_THREAD_ID
109 auto chain_B_branch_b = std::move(fork_B) | THEN_SHOW_THREAD_ID
111
112 auto chain_B = stdexec::when_all(std::move(chain_B_branch_a), std::move(chain_B_branch_b)) | THEN_SHOW_THREAD_ID
114
115 stdexec::sync_wait(
117}
118
119} // namespace Tests
#define KOKKOS_EXECUTION_STDEXEC_PRAGMA_DIAGNOSTIC_IGNORED
Basic list of ignored diagnostics when including anything from stdexec.
constexpr check_scheduler_type_t< Tag, Schd > check_scheduler_type
experimental::execution::_pool_::_static_thread_pool::scheduler static_thread_pool_scheduler_t
stdexec::run_loop::scheduler run_loop_scheduler_t
#define THEN_SHOW_THREAD_ID
Add a then using Tests::Utils::Functors::ShowThreadID. // NOLINTNEXTLINE(cppcoreguidelines-macro-usag...