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_Core.hpp"
7
8
#include "
kokkos-execution/execution_space/bulk.hpp
"
9
#include "
kokkos-execution/execution_space/continues_on.hpp
"
10
#include "
kokkos-execution/execution_space/domain.hpp
"
11
#include "
kokkos-execution/execution_space/env.hpp
"
12
#include "
kokkos-execution/execution_space/parallel_for.hpp
"
13
#include "
kokkos-execution/execution_space/schedule_from.hpp
"
14
#include "
kokkos-execution/execution_space/scoped_region.hpp
"
15
#include "
kokkos-execution/execution_space/sync_wait.hpp
"
16
#include "
kokkos-execution/execution_space/then.hpp
"
17
#include "
kokkos-execution/execution_space/when_all.hpp
"
18
#include "
kokkos-execution/impl/state.hpp
"
19
20
namespace
Kokkos::Execution
{
21
22
namespace
ExecutionSpaceImpl
{
23
30
template
<Kokkos::ExecutionSpace Exec>
31
struct
Scheduler
{
33
using
scheduler_concept
= stdexec::scheduler_t;
34
35
using
execution_space
= Exec;
36
37
template
<stdexec::receiver Rcvr>
38
struct
OpState
{
39
using
operation_state_concept
= stdexec::operation_state_tag;
40
41
Rcvr
rcvr
;
42
44
void
start
() &
noexcept
{
45
stdexec::set_value(std::move(
rcvr
));
46
}
47
};
48
49
struct
Sender
{
50
using
sender_concept
= stdexec::sender_tag;
51
52
using
completion_signatures
= stdexec::completion_signatures<stdexec::set_value_t()>;
53
55
struct
Attributes
{
56
template
<
typename
... Env>
57
[[nodiscard]]
58
constexpr
auto
59
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>, Env...) const noexcept ->
Scheduler
{
60
return
{
state
};
61
}
62
63
template
<
typename
... Env>
64
[[nodiscard]]
65
constexpr
auto
66
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>, Env...) const noexcept ->
Domain
{
67
return
{};
68
}
69
70
Impl::State<Exec>
*
state
;
71
};
72
73
template
<stdexec::receiver_of<completion_signatures> Rcvr>
74
[[nodiscard]]
75
OpState<Rcvr>
connect
(Rcvr rcvr) &&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
76
return
{std::move(rcvr)};
77
}
78
79
template
<stdexec::receiver_of<completion_signatures> Rcvr>
80
[[nodiscard]]
81
OpState<Rcvr>
connect
(Rcvr rcvr)
const
&
noexcept
(std::is_nothrow_move_constructible_v<Rcvr>) {
82
return
{std::move(rcvr)};
83
}
84
85
[[nodiscard]]
86
constexpr
auto
get_env
() const noexcept -> const
Attributes
& {
87
return
env
;
88
}
89
90
Attributes
env
;
91
};
92
93
[[nodiscard]]
94
constexpr
auto
schedule
() const noexcept -> Sender {
95
return
{
state
};
96
}
97
98
[[nodiscard]]
99
constexpr
auto
query
(stdexec::get_completion_domain_t<stdexec::set_value_t>)
const
noexcept
->
Domain
{
100
return
{};
101
}
102
103
[[nodiscard]]
104
constexpr
auto
query
(stdexec::get_completion_scheduler_t<stdexec::set_value_t>)
const
noexcept
->
Scheduler
{
105
return
{
state
};
106
}
107
108
[[nodiscard]]
109
friend
bool
operator==
(
const
Scheduler
&,
const
Scheduler
&)
noexcept
=
default
;
110
111
Impl::State<Exec>
*
state
;
112
};
113
114
}
// namespace ExecutionSpaceImpl
115
123
template
<Kokkos::ExecutionSpace Exec>
124
struct
ExecutionSpaceContext
{
125
using
state_t
=
Impl::State<Exec>
;
126
127
state_t
m_state
;
128
129
explicit
ExecutionSpaceContext
(Exec exec)
// NOLINT(performance-unnecessary-value-param)
130
:
m_state
{std::move(exec)} {
131
}
132
133
auto
get_scheduler
() const noexcept ->
ExecutionSpaceImpl
::Scheduler<Exec> {
134
return
{
const_cast<
state_t
*
>
(&
m_state
)};
135
}
136
};
137
138
}
// namespace Kokkos::Execution
139
140
#endif
// KOKKOS_EXECUTION_EXECUTION_SPACE_HPP
bulk.hpp
continues_on.hpp
env.hpp
parallel_for.hpp
schedule_from.hpp
then.hpp
when_all.hpp
domain.hpp
sync_wait.hpp
stdexec.hpp
Kokkos::Execution::ExecutionSpaceImpl
Definition
execution_space.hpp:22
Kokkos::Execution
Definition
execution_space.hpp:20
scoped_region.hpp
state.hpp
Kokkos::Execution::ExecutionSpaceContext::state_t
Impl::State< Exec > state_t
Definition
execution_space.hpp:125
Kokkos::Execution::ExecutionSpaceContext::ExecutionSpaceContext
ExecutionSpaceContext(Exec exec)
Definition
execution_space.hpp:129
Kokkos::Execution::ExecutionSpaceContext::get_scheduler
auto get_scheduler() const noexcept -> ExecutionSpaceImpl::Scheduler< Exec >
Definition
execution_space.hpp:133
Kokkos::Execution::ExecutionSpaceContext< TEST_EXECUTION_SPACE >::m_state
state_t m_state
Definition
execution_space.hpp:127
Kokkos::Execution::ExecutionSpaceImpl::Domain
Definition
domain.hpp:13
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState
Definition
execution_space.hpp:38
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::operation_state_concept
stdexec::operation_state_tag operation_state_concept
Definition
execution_space.hpp:39
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::rcvr
Rcvr rcvr
Definition
execution_space.hpp:41
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::OpState::start
void start() &noexcept
Definition
execution_space.hpp:44
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes
See https://github.com/NVIDIA/stdexec/blob/5076be2b35de2e78330201b888d82c81b8cb428b/include/nvexec/st...
Definition
execution_space.hpp:55
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:66
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::Attributes::state
Impl::State< Exec > * state
Definition
execution_space.hpp:70
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:59
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender
Definition
execution_space.hpp:49
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) &&noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
execution_space.hpp:75
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::connect
OpState< Rcvr > connect(Rcvr rcvr) const &noexcept(std::is_nothrow_move_constructible_v< Rcvr >)
Definition
execution_space.hpp:81
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::env
Attributes env
Definition
execution_space.hpp:90
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::get_env
constexpr auto get_env() const noexcept -> const Attributes &
Definition
execution_space.hpp:86
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::sender_concept
stdexec::sender_tag sender_concept
Definition
execution_space.hpp:50
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::Sender::completion_signatures
stdexec::completion_signatures< stdexec::set_value_t()> completion_signatures
Definition
execution_space.hpp:52
Kokkos::Execution::ExecutionSpaceImpl::Scheduler
Scheduler for a Kokkos execution space.
Definition
execution_space.hpp:31
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:33
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:94
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_domain_t< stdexec::set_value_t >) const noexcept -> Domain
Definition
execution_space.hpp:99
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::query
constexpr auto query(stdexec::get_completion_scheduler_t< stdexec::set_value_t >) const noexcept -> Scheduler
Definition
execution_space.hpp:104
Kokkos::Execution::ExecutionSpaceImpl::Scheduler::execution_space
Exec execution_space
Definition
execution_space.hpp:35
Kokkos::Execution::ExecutionSpaceImpl::Scheduler< TEST_EXECUTION_SPACE >::state
Impl::State< Exec > * state
Definition
execution_space.hpp:111
Kokkos::Execution::Impl::State
Definition
state.hpp:9
kokkos-execution
execution_space.hpp
Generated on
for kokkos-execution by
1.18.0