kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
graph.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_GRAPH_HPP
2
#define KOKKOS_EXECUTION_GRAPH_HPP
3
4
#include "
kokkos-execution/stdexec.hpp
"
5
6
#include "Kokkos_Macros.hpp"
7
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
8
import
kokkos.core;
9
#else
10
# include "Kokkos_Core.hpp"
11
#endif
12
13
#include "
kokkos-execution/graph/bulk.hpp
"
14
#include "
kokkos-execution/graph/continues_on.hpp
"
15
#include "
kokkos-execution/graph/domain.hpp
"
16
#include "
kokkos-execution/graph/parallel_for.hpp
"
17
#include "
kokkos-execution/graph/parallel_reduce.hpp
"
18
#include "
kokkos-execution/graph/schedule_from.hpp
"
19
#include "
kokkos-execution/graph/sync_wait.hpp
"
20
#include "
kokkos-execution/graph/then.hpp
"
21
#include "
kokkos-execution/graph/when_all.hpp
"
22
#include "
kokkos-execution/impl/state.hpp
"
23
24
namespace
Kokkos::Execution
{
25
26
namespace
GraphImpl
{
27
29
template
<Kokkos::ExecutionSpace Exec>
30
struct
Scheduler
{
32
using
scheduler_concept
= stdexec::scheduler_t;
33
34
using
execution_space
= Exec;
35
36
template
<stdexec::receiver Rcvr>
37
struct
OpState
{
38
using
operation_state_concept
= stdexec::operation_state_tag;
39
40
Impl::State<execution_space>
*
state
;
41
Rcvr
rcvr
;
42
43
[[nodiscard]]
44
constexpr
auto
query
(
Impl::get_exec_t
)
const
noexcept
->
Impl::ExecutionSpaceRef<execution_space>
{
45
return
Impl::ExecutionSpaceRef
{
state
->
exec
};
46
}
47
49
void
start
() &
noexcept
{
50
stdexec::set_value(std::move(
rcvr
));
51
}
52
};
53
54
struct
Sender
{
55
using
sender_concept
= stdexec::sender_tag;
56
57
using
completion_signatures
= stdexec::completion_signatures<stdexec::set_value_t()>;
58
60
struct
Attributes
{
61
template
<
typename
... Env>
62
[[nodiscard]]
63
constexpr
auto
64
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>, Env...) const noexcept ->
Scheduler
{
65
return
{
state
};
66
}
67
68
template
<
typename
... Env>
69
[[nodiscard]]
70
constexpr
auto
71
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>, Env...) const noexcept ->
Domain
{
72
return
{};
73
}
74
75
Impl::State<Exec>
*
state
;
76
};
77
78
template
<stdexec::receiver_of<completion_signatures> Rcvr>
79
[[nodiscard]]
80
OpState<Rcvr>
connect
(Rcvr rcvr) &&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
81
return
{.state =
env
.
state
, .rcvr = std::move(rcvr)};
82
}
83
84
template
<stdexec::receiver_of<completion_signatures> Rcvr>
85
[[nodiscard]]
86
OpState<Rcvr>
connect
(Rcvr rcvr)
const
&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
87
return
{.state =
env
.
state
, .rcvr = std::move(rcvr)};
88
}
89
90
[[nodiscard]]
91
constexpr
auto
get_env
() const noexcept -> const
Attributes
& {
92
return
env
;
93
}
94
95
Attributes
env
;
96
};
97
98
[[nodiscard]]
99
constexpr
auto
schedule
() const noexcept -> Sender {
100
return
{
state
};
101
}
102
103
[[nodiscard]]
104
constexpr
auto
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>)
const
noexcept
->
Domain
{
105
return
{};
106
}
107
108
[[nodiscard]]
109
constexpr
auto
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>)
const
noexcept
->
Scheduler
{
110
return
{
state
};
111
}
112
113
[[nodiscard]]
114
friend
bool
operator==
(
const
Scheduler
&,
const
Scheduler
&)
noexcept
=
default
;
115
116
Impl::State<Exec>
*
state
;
117
};
118
119
}
// namespace GraphImpl
120
122
template
<Kokkos::ExecutionSpace Exec>
123
struct
GraphContext
{
124
using
execution_space
= Exec;
125
126
using
state_t
=
Impl::State<execution_space>
;
127
128
state_t
m_state
;
129
130
explicit
GraphContext
(
execution_space
exec)
// NOLINT(performance-unnecessary-value-param)
131
:
m_state
{std::move(exec)} {
132
}
133
134
auto
get_scheduler
() const noexcept ->
GraphImpl
::Scheduler<
execution_space
> {
135
return
{
const_cast<
state_t
*
>
(&
m_state
)};
136
}
137
};
138
139
}
// namespace Kokkos::Execution
140
141
#endif
// KOKKOS_EXECUTION_GRAPH_HPP
bulk.hpp
continues_on.hpp
parallel_for.hpp
parallel_reduce.hpp
schedule_from.hpp
then.hpp
when_all.hpp
domain.hpp
sync_wait.hpp
stdexec.hpp
Kokkos::Execution::GraphImpl
Definition
graph.hpp:26
Kokkos::Execution
Definition
execution_space.hpp:26
state.hpp
Kokkos::Execution::GraphContext< TEST_EXECUTION_SPACE >::m_state
state_t m_state
Definition
graph.hpp:128
Kokkos::Execution::GraphContext::state_t
Impl::State< execution_space > state_t
Definition
graph.hpp:126
Kokkos::Execution::GraphContext::GraphContext
GraphContext(execution_space exec)
Definition
graph.hpp:130
Kokkos::Execution::GraphContext::get_scheduler
auto get_scheduler() const noexcept -> GraphImpl::Scheduler< execution_space >
Definition
graph.hpp:134
Kokkos::Execution::GraphContext::execution_space
Exec execution_space
Definition
graph.hpp:124
Kokkos::Execution::GraphImpl::Domain
Definition
domain.hpp:13
Kokkos::Execution::GraphImpl::Scheduler::OpState
Definition
graph.hpp:37
Kokkos::Execution::GraphImpl::Scheduler::OpState::rcvr
Rcvr rcvr
Definition
graph.hpp:41
Kokkos::Execution::GraphImpl::Scheduler::OpState::query
constexpr auto query(Impl::get_exec_t) const noexcept -> Impl::ExecutionSpaceRef< execution_space >
Definition
graph.hpp:44
Kokkos::Execution::GraphImpl::Scheduler::OpState::start
void start() &noexcept
Definition
graph.hpp:49
Kokkos::Execution::GraphImpl::Scheduler::OpState::state
Impl::State< execution_space > * state
Definition
graph.hpp:40
Kokkos::Execution::GraphImpl::Scheduler::OpState::operation_state_concept
stdexec::operation_state_tag operation_state_concept
Definition
graph.hpp:38
Kokkos::Execution::GraphImpl::Scheduler::Sender::Attributes
See https://github.com/NVIDIA/stdexec/blob/5076be2b35de2e78330201b888d82c81b8cb428b/include/nvexec/st...
Definition
graph.hpp:60
Kokkos::Execution::GraphImpl::Scheduler::Sender::Attributes::state
Impl::State< Exec > * state
Definition
graph.hpp:75
Kokkos::Execution::GraphImpl::Scheduler::Sender::Attributes::query
constexpr auto query(stdexec::get_completion_scheduler_t< stdexec::set_value_t >, Env...) const noexcept -> Scheduler
Definition
graph.hpp:64
Kokkos::Execution::GraphImpl::Scheduler::Sender::Attributes::query
constexpr auto query(stdexec::get_completion_domain_t< stdexec::set_value_t >, Env...) const noexcept -> Domain
Definition
graph.hpp:71
Kokkos::Execution::GraphImpl::Scheduler::Sender
Definition
graph.hpp:54
Kokkos::Execution::GraphImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) &&noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
graph.hpp:80
Kokkos::Execution::GraphImpl::Scheduler::Sender::get_env
constexpr auto get_env() const noexcept -> const Attributes &
Definition
graph.hpp:91
Kokkos::Execution::GraphImpl::Scheduler::Sender::sender_concept
stdexec::sender_tag sender_concept
Definition
graph.hpp:55
Kokkos::Execution::GraphImpl::Scheduler::Sender::env
Attributes env
Definition
graph.hpp:95
Kokkos::Execution::GraphImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) const &noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
graph.hpp:86
Kokkos::Execution::GraphImpl::Scheduler::Sender::completion_signatures
stdexec::completion_signatures< stdexec::set_value_t()> completion_signatures
Definition
graph.hpp:57
Kokkos::Execution::GraphImpl::Scheduler
Scheduler for a Kokkos::Experimental::Graph.
Definition
graph.hpp:30
Kokkos::Execution::GraphImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_domain_t< stdexec::set_value_t >) const noexcept -> Domain
Definition
graph.hpp:104
Kokkos::Execution::GraphImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_scheduler_t< stdexec::set_value_t >) const noexcept -> Scheduler
Definition
graph.hpp:109
Kokkos::Execution::GraphImpl::Scheduler::operator==
friend bool operator==(const Scheduler &, const Scheduler &) noexcept=default
Kokkos::Execution::GraphImpl::Scheduler::execution_space
Exec execution_space
Definition
graph.hpp:34
Kokkos::Execution::GraphImpl::Scheduler< TEST_EXECUTION_SPACE >::state
Impl::State< Exec > * state
Definition
graph.hpp:116
Kokkos::Execution::GraphImpl::Scheduler::schedule
constexpr auto schedule() const noexcept -> Sender
Definition
graph.hpp:99
Kokkos::Execution::GraphImpl::Scheduler::scheduler_concept
stdexec::scheduler_t scheduler_concept
As per https://eel.is/c++draft/exec.sched#1.
Definition
graph.hpp:32
Kokkos::Execution::Impl::ExecutionSpaceRef
Wrap a Kokkos execution space to make it cheap to copy/move in new environments.
Definition
get_exec.hpp:52
Kokkos::Execution::Impl::State
Definition
state.hpp:14
Kokkos::Execution::Impl::State::exec
Exec exec
Definition
state.hpp:15
Kokkos::Execution::Impl::get_exec_t
Definition
get_exec.hpp:20
kokkos-execution
graph.hpp
Generated on
for kokkos-execution by
1.18.0