kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
execution_space.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_HPP
2
#define KOKKOS_EXECUTION_EXECUTION_SPACE_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/execution_space/bulk.hpp
"
14
#include "
kokkos-execution/execution_space/continues_on.hpp
"
15
#include "
kokkos-execution/execution_space/domain.hpp
"
16
#include "
kokkos-execution/execution_space/env.hpp
"
17
#include "
kokkos-execution/execution_space/parallel_for.hpp
"
18
#include "
kokkos-execution/execution_space/parallel_reduce.hpp
"
19
#include "
kokkos-execution/execution_space/schedule_from.hpp
"
20
#include "
kokkos-execution/execution_space/scoped_region.hpp
"
21
#include "
kokkos-execution/execution_space/sync_wait.hpp
"
22
#include "
kokkos-execution/execution_space/then.hpp
"
23
#include "
kokkos-execution/execution_space/when_all.hpp
"
24
#include "
kokkos-execution/impl/state.hpp
"
25
26
namespace
Kokkos::Execution
{
27
28
namespace
ExecutionSpaceImpl
{
29
36
template
<Kokkos::ExecutionSpace Exec>
37
struct
Scheduler
{
39
using
scheduler_concept
= stdexec::scheduler_t;
40
41
using
execution_space
= Exec;
42
43
template
<stdexec::receiver Rcvr>
44
struct
OpState
{
45
using
operation_state_concept
= stdexec::operation_state_tag;
46
47
Rcvr
rcvr
;
48
50
void
start
() &
noexcept
{
51
stdexec::set_value(std::move(
rcvr
));
52
}
53
};
54
55
struct
Sender
{
56
using
sender_concept
= stdexec::sender_tag;
57
58
using
completion_signatures
= stdexec::completion_signatures<stdexec::set_value_t()>;
59
61
struct
Attributes
{
62
template
<
typename
... Env>
63
[[nodiscard]]
64
constexpr
auto
65
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>, Env...) const noexcept ->
Scheduler
{
66
return
{
state
};
67
}
68
69
template
<
typename
... Env>
70
[[nodiscard]]
71
constexpr
auto
72
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>, Env...) const noexcept ->
Domain
{
73
return
{};
74
}
75
76
Impl::State<Exec>
*
state
;
77
};
78
79
template
<stdexec::receiver_of<completion_signatures> Rcvr>
80
[[nodiscard]]
81
OpState<Rcvr>
connect
(Rcvr rcvr) &&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
82
return
{std::move(rcvr)};
83
}
84
85
template
<stdexec::receiver_of<completion_signatures> Rcvr>
86
[[nodiscard]]
87
OpState<Rcvr>
connect
(Rcvr rcvr)
const
&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
88
return
{std::move(rcvr)};
89
}
90
91
[[nodiscard]]
92
constexpr
auto
get_env
() const noexcept -> const
Attributes
& {
93
return
env
;
94
}
95
96
Attributes
env
;
97
};
98
99
[[nodiscard]]
100
constexpr
auto
schedule
() const noexcept -> Sender {
101
return
{
state
};
102
}
103
104
[[nodiscard]]
105
constexpr
auto
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>)
const
noexcept
->
Domain
{
106
return
{};
107
}
108
109
[[nodiscard]]
110
constexpr
auto
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>)
const
noexcept
->
Scheduler
{
111
return
{
state
};
112
}
113
114
[[nodiscard]]
115
friend
bool
operator==
(
const
Scheduler
&,
const
Scheduler
&)
noexcept
=
default
;
116
117
Impl::State<Exec>
*
state
;
118
};
119
120
}
// namespace ExecutionSpaceImpl
121
129
template
<Kokkos::ExecutionSpace Exec>
130
struct
ExecutionSpaceContext
{
131
using
execution_space
= Exec;
132
133
using
state_t
=
Impl::State<execution_space>
;
134
135
state_t
m_state
;
136
137
explicit
ExecutionSpaceContext
(
execution_space
exec)
// NOLINT(performance-unnecessary-value-param)
138
:
m_state
{std::move(exec)} {
139
}
140
141
auto
get_scheduler
() const noexcept ->
ExecutionSpaceImpl
::Scheduler<
execution_space
> {
142
return
{
const_cast<
state_t
*
>
(&
m_state
)};
143
}
144
};
145
146
}
// namespace Kokkos::Execution
147
148
#endif
// KOKKOS_EXECUTION_EXECUTION_SPACE_HPP
bulk.hpp
continues_on.hpp
env.hpp
parallel_for.hpp
parallel_reduce.hpp
schedule_from.hpp
then.hpp
when_all.hpp
domain.hpp
sync_wait.hpp
stdexec.hpp
Kokkos::Execution::ExecutionSpaceImpl
Definition
execution_space.hpp:28
Kokkos::Execution
Definition
execution_space.hpp:26
scoped_region.hpp
state.hpp
Kokkos::Execution::ExecutionSpaceContext::ExecutionSpaceContext
ExecutionSpaceContext(execution_space exec)
Definition
execution_space.hpp:137
Kokkos::Execution::ExecutionSpaceContext::state_t
Impl::State< execution_space > state_t
Definition
execution_space.hpp:133
Kokkos::Execution::ExecutionSpaceContext::execution_space
Exec execution_space
Definition
execution_space.hpp:131
Kokkos::Execution::ExecutionSpaceContext< TEST_EXECUTION_SPACE >::m_state
state_t m_state
Definition
execution_space.hpp:135
Kokkos::Execution::ExecutionSpaceContext::get_scheduler
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< execution_space >
Definition
execution_space.hpp:141
Kokkos::Execution::ExecutionSpaceImpl::Domain
Definition
domain.hpp:13
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState
Definition
execution_space.hpp:44
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::operation_state_concept
stdexec::operation_state_tag operation_state_concept
Definition
execution_space.hpp:45
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::rcvr
Rcvr rcvr
Definition
execution_space.hpp:47
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::start
void start() &noexcept
Definition
execution_space.hpp:50
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes
See https://github.com/NVIDIA/stdexec/blob/5076be2b35de2e78330201b888d82c81b8cb428b/include/nvexec/st...
Definition
execution_space.hpp:61
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes::query
constexpr auto query(stdexec::get_completion_domain_t< stdexec::set_value_t >, Env...) const noexcept -> Domain
Definition
execution_space.hpp:72
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes::state
Impl::State< Exec > * state
Definition
execution_space.hpp:76
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes::query
constexpr auto query(stdexec::get_completion_scheduler_t< stdexec::set_value_t >, Env...) const noexcept -> Scheduler
Definition
execution_space.hpp:65
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender
Definition
execution_space.hpp:55
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) &&noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
execution_space.hpp:81
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) const &noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
execution_space.hpp:87
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::env
Attributes env
Definition
execution_space.hpp:96
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::get_env
constexpr auto get_env() const noexcept -> const Attributes &
Definition
execution_space.hpp:92
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::sender_concept
stdexec::sender_tag sender_concept
Definition
execution_space.hpp:56
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::completion_signatures
stdexec::completion_signatures< stdexec::set_value_t()> completion_signatures
Definition
execution_space.hpp:58
Kokkos::Execution::ExecutionSpaceImpl::Scheduler
Scheduler for a Kokkos execution space.
Definition
execution_space.hpp:37
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::scheduler_concept
stdexec::scheduler_t scheduler_concept
As per https://eel.is/c++draft/exec.sched#1.
Definition
execution_space.hpp:39
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::operator==
friend bool operator==(const Scheduler &, const Scheduler &) noexcept=default
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::schedule
constexpr auto schedule() const noexcept -> Sender
Definition
execution_space.hpp:100
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_domain_t< stdexec::set_value_t >) const noexcept -> Domain
Definition
execution_space.hpp:105
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_scheduler_t< stdexec::set_value_t >) const noexcept -> Scheduler
Definition
execution_space.hpp:110
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::execution_space
Exec execution_space
Definition
execution_space.hpp:41
Kokkos::Execution::ExecutionSpaceImpl::Scheduler< TEST_EXECUTION_SPACE >::state
Impl::State< Exec > * state
Definition
execution_space.hpp:117
Kokkos::Execution::Impl::State
Definition
state.hpp:14
kokkos-execution
execution_space.hpp
Generated on
for kokkos-execution by
1.18.0