kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
when_all.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_WHEN_ALL_HPP
2
#define KOKKOS_EXECUTION_EXECUTION_SPACE_WHEN_ALL_HPP
3
4
#include "
kokkos-execution/execution_space/execution_space_fwd.hpp
"
5
6
#include "
kokkos-execution/execution_space/env.hpp
"
7
#include "
kokkos-execution/impl/get_exec.hpp
"
8
#include "
kokkos-execution/stdexec.hpp
"
9
10
namespace
Kokkos::Execution::ExecutionSpaceImpl
{
11
12
struct
when_all_t
{ };
13
14
}
// namespace Kokkos::Execution::ExecutionSpaceImpl
15
16
namespace
stdexec
{
17
template
<>
18
struct
__sexpr_impl<
Kokkos
::Execution::ExecutionSpaceImpl::when_all_t> : stdexec::__when_all::__when_all_impl {
19
using
base_t
= stdexec::__when_all::__when_all_impl;
20
21
template
<
typename
State>
22
using
state_env_t
= stdexec::env_of_t<decltype(std::declval<const State&>().__rcvr_)>;
23
24
template
<
typename
State>
25
using
state_exec_env_policy_t
=
26
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec_policy_t<state_env_t<State>
>;
27
28
template
<
typename
State>
29
using
base_env_t
=
decltype
(base_t::__get_env(stdexec::__ignore{}, std::declval<const State&>()));
30
31
template
<
typename
ExecEnvPolicy,
typename
State>
32
struct
get_env_impl
;
33
34
template
<
typename
State>
35
struct
get_env_impl
<
Kokkos
::Execution::ExecutionSpaceImpl::WithExecEnvPolicy, State> {
36
using
execution_space
=
Kokkos::Execution::Impl::exec_of_t<state_env_t<State>
>;
37
38
using
type
=
decltype
(
Kokkos::Execution::ExecutionSpaceImpl::join_env_with_exec
(
39
std::declval<
base_env_t<State>
>(),
40
std::declval<execution_space>()));
41
42
[[nodiscard]]
43
static
constexpr
auto
get_env
(
const
State& state)
noexcept
->
type
{
44
return
Kokkos::Execution::ExecutionSpaceImpl::join_env_with_exec
(
45
base_t::__get_env(stdexec::__ignore{}, state),
46
Kokkos::Execution::Impl::get_exec
(stdexec::get_env(state.__rcvr_)).get());
47
}
48
};
49
50
template
<
typename
State>
51
struct
get_env_impl
<
Kokkos
::Execution::ExecutionSpaceImpl::WithoutExecEnvPolicy, State> {
52
using
type
=
base_env_t<State>
;
53
54
[[nodiscard]]
55
static
constexpr
auto
get_env
(
const
State& state)
noexcept
->
type
{
56
return
base_t::__get_env(stdexec::__ignore{}, state);
57
}
58
};
59
67
static
constexpr
auto
__get_env
=
// NOLINT(bugprone-reserved-identifier)
68
[]<
typename
State>(stdexec::__ignore,
const
State& state)
noexcept
->
69
typename
get_env_impl
<
state_exec_env_policy_t<State>
, State>::type {
70
return
get_env_impl<state_exec_env_policy_t<State>
, State>::get_env(state);
71
};
72
81
template
<
typename
Self,
typename
... Envs>
82
static
consteval
auto
__get_completion_signatures
() {
// NOLINT(bugprone-reserved-identifier)
83
if
constexpr
(stdexec::__minvocable_q<stdexec::__when_all::__when_all_impl::__completions_t, Self, Envs...>) {
84
return
stdexec::__when_all::__when_all_impl::__completions_t<Self, Envs...>{};
85
}
else
if
constexpr
(
sizeof
...(Envs) == 0) {
86
return
stdexec::__throw_dependent_sender_error<Self>();
87
}
88
}
89
};
90
91
}
// namespace stdexec
92
93
namespace
Kokkos::Execution::ExecutionSpaceImpl
{
94
95
template
<>
96
struct
TransformSenderFor
<
stdexec
::
when_all_t
> {
97
template
<
typename
Env,
typename
... Sndrs>
98
auto
operator()
(
const
Env&, stdexec::when_all_t, stdexec::__, Sndrs&&... sndrs)
const
{
99
return
stdexec::__make_sexpr<Kokkos::Execution::ExecutionSpaceImpl::when_all_t>(
100
stdexec::__{}, std::forward<Sndrs>(sndrs)...);
101
}
102
};
103
104
}
// namespace Kokkos::Execution::ExecutionSpaceImpl
105
106
#endif
// KOKKOS_EXECUTION_EXECUTION_SPACE_WHEN_ALL_HPP
env.hpp
execution_space_fwd.hpp
get_exec.hpp
stdexec.hpp
Kokkos::Execution::ExecutionSpaceImpl
Definition
execution_space.hpp:22
Kokkos::Execution::ExecutionSpaceImpl::join_env_with_exec
constexpr auto join_env_with_exec(Env &&env, const Exec &exec) noexcept
Unconditionally join exec to env.
Definition
env.hpp:15
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec_policy_t
std::conditional_t< stdexec::__queryable_with< Env, Impl::get_exec_t >, WithExecEnvPolicy, WithoutExecEnvPolicy > extend_env_with_exec_policy_t
If Env is queryable with Impl::get_exec_t, use WithExecEnvPolicy.
Definition
env.hpp:55
Kokkos::Execution::Impl::get_exec
constexpr get_exec_t get_exec
Definition
get_exec.hpp:19
Kokkos::Execution::Impl::exec_of_t
typename ExecOf< Args... >::type exec_of_t
Definition
get_exec.hpp:37
Kokkos
stdexec
Definition
when_all.hpp:16
Kokkos::Execution::ExecutionSpaceImpl::TransformSenderFor< stdexec::when_all_t >::operator()
auto operator()(const Env &, stdexec::when_all_t, stdexec::__, Sndrs &&... sndrs) const
Definition
when_all.hpp:98
Kokkos::Execution::ExecutionSpaceImpl::TransformSenderFor
Definition
execution_space_fwd.hpp:12
Kokkos::Execution::ExecutionSpaceImpl::when_all_t
Definition
when_all.hpp:12
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl
Definition
when_all.hpp:32
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::__get_env
static constexpr auto __get_env
Definition
when_all.hpp:67
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::state_env_t
stdexec::env_of_t< decltype(std::declval< const State & >().__rcvr_)> state_env_t
Definition
when_all.hpp:22
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::state_exec_env_policy_t
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec_policy_t< state_env_t< State > > state_exec_env_policy_t
Definition
when_all.hpp:25
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::__get_completion_signatures
static consteval auto __get_completion_signatures()
Definition
when_all.hpp:82
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::base_env_t
decltype(base_t::__get_env(stdexec::__ignore{}, std::declval< const State & >())) base_env_t
Definition
when_all.hpp:29
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::base_t
stdexec::__when_all::__when_all_impl base_t
Definition
when_all.hpp:19
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl< Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy, State >::get_env
static constexpr auto get_env(const State &state) noexcept -> type
Definition
when_all.hpp:43
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl< Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy, State >::execution_space
Kokkos::Execution::Impl::exec_of_t< state_env_t< State > > execution_space
Definition
when_all.hpp:36
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl< Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy, State >::type
decltype(Kokkos::Execution::ExecutionSpaceImpl::join_env_with_exec( std::declval< base_env_t< State > >(), std::declval< execution_space >())) type
Definition
when_all.hpp:38
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl< Kokkos::Execution::ExecutionSpaceImpl::WithoutExecEnvPolicy, State >::get_env
static constexpr auto get_env(const State &state) noexcept -> type
Definition
when_all.hpp:55
stdexec::__sexpr_impl< Kokkos::Execution::ExecutionSpaceImpl::when_all_t >::get_env_impl< Kokkos::Execution::ExecutionSpaceImpl::WithoutExecEnvPolicy, State >::type
base_env_t< State > type
Definition
when_all.hpp:52
kokkos-execution
execution_space
when_all.hpp
Generated on
for kokkos-execution by
1.18.0