kokkos-execution
0.0.1
Loading...
Searching...
No Matches
test_sync_wait.cpp
Go to the documentation of this file.
1
#include "
kokkos-utils/callbacks/RecorderListener.hpp
"
2
3
#include "
tests/utils/callback_matchers.hpp
"
4
#include "
tests/utils/execution_space_context.hpp
"
5
#include "
tests/utils/functors/throws_when_copied.hpp
"
6
18
19
namespace
Tests::ExecutionSpaceImpl
{
20
21
using
ExecutionSpaceContextTest
=
Tests::Utils::ExecutionSpaceContextTest<TEST_EXECUTION_SPACE>
;
22
28
TEST_F(
ExecutionSpaceContextTest
, sync_wait) {
29
const
context_t
esc{
exec
};
30
31
auto
chain = stdexec::schedule(esc.
get_scheduler
());
32
33
Kokkos::utils::callbacks::Manager::initialize
();
34
35
ASSERT_THAT(
36
Kokkos::utils::callbacks::RecorderListener<Kokkos::utils::callbacks::BeginFenceEvent>::record
(
37
[chain = std::move(chain)]()
mutable
{
// NOLINT(performance-move-const-arg)
38
const
auto
value = stdexec::sync_wait(std::move(chain));
// NOLINT(performance-move-const-arg)
39
static_assert
(std::same_as<
decltype
(value),
const
std::optional<std::tuple<>>>);
40
ASSERT_TRUE(value.has_value());
41
}),
42
testing::ElementsAre(
MATCHER_FOR_BEGIN_FENCE
(
exec
,
dispatch_label
(
exec
,
"sync_wait"
))));
43
44
Kokkos::utils::callbacks::Manager::finalize
();
45
}
46
48
TEST_F(
ExecutionSpaceContextTest
, rethrows) {
49
const
context_t
esc{
exec
};
50
51
auto
chain = stdexec::schedule(esc.
get_scheduler
()) | stdexec::then(
Tests::Utils::Functors::ThrowsWhenCopied
{});
52
53
ASSERT_THAT(
54
Tests::Utils::Functors::MutableMoveToSyncWait
{.sndr = std::move(chain)},
55
testing::ThrowsMessage<std::runtime_error>(testing::StrEq(
"ThrowsWhenCopied: Throwing in copy constructor!"
)));
56
}
57
58
}
// namespace Tests::ExecutionSpaceImpl
RecorderListener.hpp
callback_matchers.hpp
dispatch_label
constexpr std::string dispatch_label(const Exec &, Label &&label)
Get the dispatch label from Exec and label.
Definition
callback_matchers.hpp:47
MATCHER_FOR_BEGIN_FENCE
#define MATCHER_FOR_BEGIN_FENCE(_exec_, _label_)
Definition
callback_matchers.hpp:28
Kokkos::utils::callbacks::Manager::initialize
static void initialize()
Kokkos::utils::callbacks::Manager::finalize
static void finalize()
Kokkos::utils::callbacks::RecorderListener
execution_space_context.hpp
Tests::ExecutionSpaceImpl
Definition
test_any_sender.cpp:33
Tests::ExecutionSpaceImpl::ExecutionSpaceContextTest
Tests::Utils::ExecutionSpaceContextTest< TEST_EXECUTION_SPACE > ExecutionSpaceContextTest
Definition
test_sync_wait.cpp:21
Kokkos::Execution::ExecutionSpaceContext::get_scheduler
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Definition
execution_space.hpp:136
Kokkos::utils::tests::scoped::ExecutionSpace< Exec >::exec
Exec exec
Tests::Utils::ContextTest< Kokkos::Execution::ExecutionSpaceContext, Exec >::context_t
Kokkos::Execution::ExecutionSpaceContext< Exec > context_t
Definition
context.hpp:25
Tests::Utils::ExecutionSpaceContextTest
Definition
execution_space_context.hpp:11
Tests::Utils::Functors::MutableMoveToSyncWait
Definition
throws_when_copied.hpp:16
Tests::Utils::Functors::ThrowsWhenCopied
This helper struct throws when copy constructed.
Definition
throws_when_copied.hpp:30
throws_when_copied.hpp
tests
execution_space
test_sync_wait.cpp
Generated on
for kokkos-execution by
1.15.0