kokkos-execution 0.0.1
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
5
9
11
12struct when_all_t { };
13
14} // namespace Kokkos::Execution::ExecutionSpaceImpl
15
16namespace stdexec {
17template <>
18struct __sexpr_impl<Kokkos::Execution::ExecutionSpaceImpl::when_all_t> : stdexec::__when_all::__when_all_impl {
26 static constexpr auto __get_env = // NOLINT(bugprone-reserved-identifier)
27 []<typename State>(stdexec::__ignore, const State& state) noexcept {
28 auto env = stdexec::__when_all::__when_all_impl::__get_env(stdexec::__ignore{}, state);
29
30 using exec_env_policy_t =
31 Kokkos::Execution::ExecutionSpaceImpl::exec_env_policy_t<stdexec::env_of_t<decltype(state.__rcvr_)>>;
32
33 if constexpr (std::same_as<exec_env_policy_t, Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy>) {
35 std::move(env), Kokkos::Execution::Impl::get_exec(stdexec::get_env(state.__rcvr_)).get());
36 } else {
37 return std::move(env);
38 }
39 };
40
49 template <typename Self, typename... Envs>
50 static consteval auto __get_completion_signatures() { // NOLINT(bugprone-reserved-identifier)
51 if constexpr (stdexec::__minvocable_q<stdexec::__when_all::__when_all_impl::__completions_t, Self, Envs...>) {
52 return stdexec::__when_all::__when_all_impl::__completions_t<Self, Envs...>{};
53 } else if constexpr (sizeof...(Envs) == 0) {
54 return stdexec::__throw_dependent_sender_error<Self>();
55 }
56 }
57};
58
59} // namespace stdexec
60
62
63template <>
65 template <typename Env, typename... Sndrs>
66 auto operator()(const Env&, stdexec::when_all_t, stdexec::__, Sndrs&&... sndrs) const {
67 return stdexec::__make_sexpr<Kokkos::Execution::ExecutionSpaceImpl::when_all_t>(
68 stdexec::__{}, std::forward<Sndrs>(sndrs)...);
69 }
70};
71
72} // namespace Kokkos::Execution::ExecutionSpaceImpl
73
74#endif // KOKKOS_EXECUTION_EXECUTION_SPACE_WHEN_ALL_HPP
constexpr auto join_env_with_exec(Env &&env, const Exec &exec) noexcept
Unconditionally join exec to env.
Definition env.hpp:15
std::conditional_t< stdexec::__queryable_with< Env, Impl::get_exec_t >, WithExecEnvPolicy, WithoutExecEnvPolicy > exec_env_policy_t
If Env is queryable with Impl::get_exec_t, use WithExecEnvPolicy.
Definition env.hpp:55
constexpr get_exec_t get_exec
Definition get_exec.hpp:17
auto operator()(const Env &, stdexec::when_all_t, stdexec::__, Sndrs &&... sndrs) const
Definition when_all.hpp:66