kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
env.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_EXECUTION_SPACE_ENV_HPP
2
#define KOKKOS_EXECUTION_EXECUTION_SPACE_ENV_HPP
3
4
#include "
kokkos-execution/stdexec.hpp
"
5
6
#include "
kokkos-execution/impl/get_exec.hpp
"
7
8
namespace
Kokkos::Execution::ExecutionSpaceImpl
{
9
10
struct
WithExecEnvPolicy
{ };
11
12
struct
WithoutExecEnvPolicy
{ };
13
15
template
<
typename
Env, Kokkos::ExecutionSpace Exec>
16
constexpr
auto
join_env_with_exec
(Env&& env,
const
Exec& exec)
noexcept
{
17
return
stdexec::__env::__join(
18
stdexec::prop{
Impl::get_exec
,
Impl::ExecutionSpaceRef
{exec}}, stdexec::__fwd_env(std::forward<Env>(env)));
19
}
20
22
template
<
typename
ExecEnvPolicy,
typename
Env, Kokkos::ExecutionSpace Exec>
23
constexpr
auto
join_env_with_exec
(Env&& env,
const
Exec& exec)
noexcept
{
24
if
constexpr
(std::same_as<ExecEnvPolicy, WithExecEnvPolicy>) {
25
return
join_env_with_exec
(std::forward<Env>(env), exec);
26
}
else
{
27
return
stdexec::__fwd_env(std::forward<Env>(env));
28
}
29
}
30
31
template
<
typename
ExecEnvPolicy,
typename
Env, Kokkos::ExecutionSpace Exec>
32
using
join_env_with_exec_t
=
decltype
(
join_env_with_exec<ExecEnvPolicy>
(std::declval<Env>(), std::declval<Exec>()));
33
40
template
<
typename
ExecEnvPolicy,
typename
Env>
41
constexpr
auto
extend_env_with_exec
(Env&& env)
noexcept
{
42
if
constexpr
(std::same_as<ExecEnvPolicy, WithExecEnvPolicy>) {
43
auto
ref =
Impl::get_exec
(env);
44
return
stdexec::__env::__join(
45
stdexec::prop{
Impl::get_exec
, std::move(ref)}, stdexec::__fwd_env(std::forward<Env>(env)));
46
}
else
{
47
return
stdexec::__fwd_env(std::forward<Env>(env));
48
}
49
}
50
51
template
<
typename
ExecEnvPolicy,
typename
Env>
52
using
extend_env_with_exec_t
=
decltype
(
extend_env_with_exec<ExecEnvPolicy>
(std::declval<Env>()));
53
55
template
<
typename
Env>
56
using
extend_env_with_exec_policy_t
=
57
std::conditional_t<stdexec::__queryable_with<Env, Impl::get_exec_t>,
WithExecEnvPolicy
,
WithoutExecEnvPolicy
>;
58
59
}
// namespace Kokkos::Execution::ExecutionSpaceImpl
60
61
#endif
// KOKKOS_EXECUTION_EXECUTION_SPACE_ENV_HPP
get_exec.hpp
stdexec.hpp
Kokkos::Execution::ExecutionSpaceImpl
Definition
execution_space.hpp:28
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec_t
decltype(extend_env_with_exec< ExecEnvPolicy >(std::declval< Env >())) extend_env_with_exec_t
Definition
env.hpp:52
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:16
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:56
Kokkos::Execution::ExecutionSpaceImpl::join_env_with_exec_t
decltype(join_env_with_exec< ExecEnvPolicy >(std::declval< Env >(), std::declval< Exec >())) join_env_with_exec_t
Definition
env.hpp:32
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec
constexpr auto extend_env_with_exec(Env &&env) noexcept
Definition
env.hpp:41
Kokkos::Execution::Impl::get_exec
constexpr get_exec_t get_exec
Definition
get_exec.hpp:24
Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy
Definition
env.hpp:10
Kokkos::Execution::ExecutionSpaceImpl::WithoutExecEnvPolicy
Definition
env.hpp:12
Kokkos::Execution::Impl::ExecutionSpaceRef
Wrap a Kokkos execution space to make it cheap to copy/move in new environments.
Definition
get_exec.hpp:52
kokkos-execution
execution_space
env.hpp
Generated on
for kokkos-execution by
1.18.0