kokkos-execution 0.0.1
Loading...
Searching...
No Matches
continues_on.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_CONTINUES_ON_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_CONTINUES_ON_HPP
3
7
9
11template <typename ExecEnvPolicy, stdexec::scheduler Schd, stdexec::receiver Rcvr>
13 using receiver_concept = stdexec::receiver_tag;
14
15 Schd schd;
16 Rcvr rcvr;
17
18 void set_value() && noexcept {
19 stdexec::set_value(std::move(rcvr));
20 }
21
22 template <typename Error>
23 void set_error(Error&& err) && noexcept {
24 stdexec::set_error(std::move(rcvr), std::forward<Error>(err));
25 }
26
27 void set_stopped() && noexcept {
28 stdexec::set_stopped(std::move(rcvr));
29 }
30
31 [[nodiscard]]
32 constexpr auto get_env() const noexcept
33 -> join_env_with_exec_t<ExecEnvPolicy, stdexec::env_of_t<Rcvr>, typename Schd::execution_space> {
34 return join_env_with_exec<ExecEnvPolicy>(stdexec::get_env(rcvr), schd.state->exec);
35 }
36};
37
39template <stdexec::scheduler Schd, stdexec::sender Sndr>
41 using sender_concept = stdexec::sender_tag;
42
43 Schd schd;
44 Sndr sndr; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
45
47
48 template <typename Rcvr>
49 using exec_env_policy_t = std::conditional_t<
50 std::same_as<
51 stdexec::__completion_domain_of_t<stdexec::set_value_t, Sndr, stdexec::__fwd_env_t<stdexec::env_of_t<Rcvr>>>,
52 Domain
53 >,
56 >;
57
58 template <typename Rcvr>
60
61 template <stdexec::receiver Rcvr>
62 auto connect(Rcvr rcvr) && noexcept(
63 std::is_nothrow_constructible_v<rcvr_t<Rcvr>, Schd&&, Rcvr&&>
64 && stdexec::__nothrow_connectable<Sndr&&, rcvr_t<Rcvr>>) -> stdexec::connect_result_t<Sndr, rcvr_t<Rcvr>> {
65 return stdexec::connect(
66 std::forward<Sndr>(sndr), rcvr_t<Rcvr>{.schd = std::forward<Schd>(schd), .rcvr = std::move(rcvr)});
67 }
68
70};
71
72template <>
73struct TransformSenderFor<stdexec::continues_on_t> {
74 template <typename Env, stdexec::__is_instance_of<Scheduler> Schd, stdexec::sender Sndr>
75 auto operator()(const Env&, stdexec::continues_on_t, Schd&& schd, Sndr&& sndr) const
76 noexcept(std::is_nothrow_constructible_v<ContinuesOnSender<Schd, Sndr>, Schd&&, Sndr&&>) {
77 return ContinuesOnSender<Schd, Sndr>{.schd = std::forward<Schd>(schd), .sndr = std::forward<Sndr>(sndr)};
78 }
79};
80
81} // namespace Kokkos::Execution::ExecutionSpaceImpl
82
83#endif // KOKKOS_EXECUTION_EXECUTION_SPACE_CONTINUES_ON_HPP
#define KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV(_type_, _obj_)
#define KOKKOS_EXECUTION_COMPL_SIGS_KEEP(_sndr_type_)
constexpr auto join_env_with_exec(Env &&env, const Exec &exec) noexcept
Unconditionally join exec to env.
Definition env.hpp:15
decltype(join_env_with_exec< ExecEnvPolicy >(std::declval< Env >(), std::declval< Exec >())) join_env_with_exec_t
Definition env.hpp:31
constexpr auto get_env() const noexcept -> join_env_with_exec_t< ExecEnvPolicy, stdexec::env_of_t< Rcvr >, typename Schd::execution_space >
std::conditional_t< std::same_as< stdexec::__completion_domain_of_t< stdexec::set_value_t, Sndr, stdexec::__fwd_env_t< stdexec::env_of_t< Rcvr > > >, Domain >, WithExecEnvPolicy, WithoutExecEnvPolicy > exec_env_policy_t
ContinuesOnReceiver< exec_env_policy_t< Rcvr >, Schd, Rcvr > rcvr_t
auto connect(Rcvr rcvr) &&noexcept(std::is_nothrow_constructible_v< rcvr_t< Rcvr >, Schd &&, Rcvr && > &&stdexec::__nothrow_connectable< Sndr &&, rcvr_t< Rcvr > >) -> stdexec::connect_result_t< Sndr, rcvr_t< Rcvr > >
auto operator()(const Env &, stdexec::continues_on_t, Schd &&schd, Sndr &&sndr) const noexcept(std::is_nothrow_constructible_v< ContinuesOnSender< Schd, Sndr >, Schd &&, Sndr && >)
Kokkos::DefaultExecutionSpace execution_space