1#include "gmock/gmock.h"
2#include "gtest/gtest.h"
23#if !defined(KOKKOS_EXECUTION_ENABLE_EVENT_DISPATCH)
24# error "This is not supported."
29using namespace Kokkos::utils::callbacks;
58 std::declval<std::string>(),
59 std::declval<const EventsTest::graph_t::root_t&>(),
60 std::declval<const EventsTest::graph_t::root_t&>())));
66 std::declval<const EventsTest::graph_t&>(), std::declval<const TEST_EXECUTION_SPACE&>())));
69 std::declval<const EventsTest::graph_t&>(), std::declval<const TEST_EXECUTION_SPACE&>())));
78 const auto recorded_events = recorder_listener_t::record([
this]() {
87 recorded_events.at(0),
101 const auto recorded_events = recorder_listener_t::record([
this]() {
105 const auto root = graph.root_node();
107 const auto node_A = root.then(Kokkos::Experimental::node_props(
device_handle), KOKKOS_LAMBDA(){});
110 const auto node_B = node_A.then(Kokkos::Experimental::node_props(
device_handle), KOKKOS_LAMBDA(){});
115 testing::ElementsAre(
118 recorded_events.at(0),
127TEST(GraphCreateEvent, streaming_operator) {
129 .graph =
reinterpret_cast<void*
>(0x7f3a2b4c8000),
130 .root_node =
reinterpret_cast<void*
>(0x7f6d9e1a5000),
134 std::ostringstream oss;
139 "GraphCreateEvent: {graph = 0x7f3a2b4c8000, root_node = 0x7f6d9e1a5000, dev_id = 8, event_id = 666}");
143TEST(GraphAddAggregateNodeEvent, streaming_operator) {
145 .graph =
reinterpret_cast<void*
>(0x7f3a2b4c8000),
146 .predecessors = {
reinterpret_cast<void*
>(0x7f6d9e1a5000),
reinterpret_cast<void*
>(0x7f6d9e1a5500)},
147 .node =
reinterpret_cast<void*
>(0x7f7d9e1a5000)
150 std::ostringstream oss;
155 "GraphAddAggregateNodeEvent: {graph = 0x7f3a2b4c8000, predecessors = [0x7f6d9e1a5000, 0x7f6d9e1a5500], node = "
RecorderListener< GraphEventDiscardMatcher< TEST_EXECUTION_SPACE >, BeginFenceEvent, Kokkos::Execution::GraphImpl::GraphAddNodeEvent, Kokkos::Execution::GraphImpl::GraphCreateEvent, Kokkos::Execution::GraphImpl::GraphInstantiateEvent, Kokkos::Execution::GraphImpl::GraphSubmitEvent > recorder_listener_t
void graph_add_node_event(Label &&label, const Predecessor &predecessor, const NodeType &node)
Record an event for a node added after predecessor.
void graph_create_event(const Kokkos::Experimental::Graph< Exec > &graph)
Record a GraphCreateEvent event.
auto * get_node_ptr(const NodeType &node) noexcept
Retrieve the raw node pointer.
auto create_graph(const Kokkos::Impl::DeviceHandle< Exec > &device_handle, Args &&... args)
Create a graph and record the associated event with graph_create_event.
void graph_instantiate_event(const Kokkos::Experimental::Graph< Exec > &graph)
Record a GraphInstantiateEvent event.
void graph_submit_event(const Kokkos::Experimental::Graph< Exec > &graph, const Exec &exec)
Record a GraphSubmitEvent event.
auto * get_graph_impl_ptr(const NodeType &node) noexcept
Retrieve the raw graph pointer from a node.
void submit_graph(const Kokkos::Experimental::Graph< Exec > &graph, const Exec &exec)
Submit a graph and record the associated event with graph_submit_event.
consteval bool test_noexcept()
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph aggregate node is added.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph node is added.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is created.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is instantiated.
Event to be sent to Kokkos::utils::callbacks::dispatch when a Kokkos graph is submitted.
Similar to EventDiscardMatcher, for graph-related events.
Kokkos::Experimental::Graph< Exec > graph_t
device_handle_t device_handle
#define MATCHER_FOR_GRAPH_CREATE(_device_handle_)
#define MATCHER_FOR_GRAPH_ADDNODE(_graph_create_event_variant_, _device_handle_, _predecessor_,...)
#define MATCHER_FOR_GRAPH_SUBMIT(_exec_, _graph_create_event_variant_)
#define MATCHER_FOR_GRAPH_ROOT_NODE_OF(_graph_create_event_)
#define MATCHER_FOR_GRAPH_INSTANTIATE(_graph_create_event_variant_)
#define MATCHER_FOR_GRAPH_NODE_OF(_graph_add_node_event_)