kokkos-execution 0.0.1
Loading...
Searching...
No Matches
then.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_THEN_HPP
2#define KOKKOS_EXECUTION_EXECUTION_SPACE_THEN_HPP
3
5
10
12
14template <typename Functor>
15requires(std::same_as<void, std::invoke_result_t<Functor>>)
17 Functor functor; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
18
19 template <std::integral T>
20 KOKKOS_FUNCTION void operator()(const T) const {
21 functor();
22 }
23};
24
25template <>
26struct TransformSenderFor<stdexec::then_t> {
27 template <typename Sndr, typename Env>
28 using policy_t = Kokkos::RangePolicy<exec_of_t<Sndr, Env>, Kokkos::LaunchBounds<1>>;
29
30 template <typename Env, typename Functor, typename Sndr>
32
33 template <typename Env, typename Functor, execution_space_completing_sender<Env> Sndr>
34 requires requires { typename exec_of_t<Sndr, Env>; }
35 auto operator()(const Env& env, stdexec::then_t, Functor&& functor, Sndr&& sndr) const
36 noexcept(std::is_nothrow_constructible_v<
40 Sndr&&
41 >) {
42 auto schd = stdexec::get_completion_scheduler<stdexec::set_value_t>(stdexec::get_env(sndr), env);
43
47 ThenWrapper<Functor>{std::forward<Functor>(functor)},
48 policy_t<Sndr, Env>(schd.state->exec, 0, 1)}},
49 std::forward<Sndr>(sndr)};
50 }
51};
52
53} // namespace Kokkos::Execution::ExecutionSpaceImpl
54
55#endif // KOKKOS_EXECUTION_EXECUTION_SPACE_THEN_HPP
typename stdexec::__completion_scheduler_of_t< stdexec::set_value_t, Sndr, Env >::execution_space exec_of_t
Type of the execution space extracted from a sender's completion scheduler.
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
Inspired by https://github.com/kokkos/kokkos/blob/69273c3a4e7b6adeb95066341ca201d62fe1e698/core/src/i...
Definition then.hpp:16
ParallelForSender< Sndr, std::string_view, ThenWrapper< Functor >, policy_t< Sndr, Env > > trnsfrmd_sndr_t
Definition then.hpp:31
auto operator()(const Env &env, stdexec::then_t, Functor &&functor, Sndr &&sndr) const noexcept(std::is_nothrow_constructible_v< trnsfrmd_sndr_t< Env, Functor, Sndr >, parallel_for_t, typename trnsfrmd_sndr_t< Env, Functor, Sndr >::closure_t &&, Sndr && >)
Definition then.hpp:35
Kokkos::RangePolicy< exec_of_t< Sndr, Env >, Kokkos::LaunchBounds< 1 > > policy_t
Definition then.hpp:28
Custom algorithm for the Kokkos::parallel_for construct.