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
struct
WithoutExecEnvPolicy
{ };
12
14
template
<
typename
Env, Kokkos::ExecutionSpace Exec>
15
constexpr
auto
join_env_with_exec
(Env&& env,
const
Exec& exec)
noexcept
{
16
return
stdexec::__env::__join(
17
stdexec::prop{
Impl::get_exec
,
Impl::ExecutionSpaceRef
{exec}}, stdexec::__fwd_env(std::forward<Env>(env)));
18
}
19
21
template
<
typename
ExecEnvPolicy,
typename
Env, Kokkos::ExecutionSpace Exec>
22
constexpr
auto
join_env_with_exec
(Env&& env,
const
Exec& exec)
noexcept
{
23
if
constexpr
(std::same_as<ExecEnvPolicy, WithExecEnvPolicy>) {
24
return
join_env_with_exec
(std::forward<Env>(env), exec);
25
}
else
{
26
return
stdexec::__fwd_env(std::forward<Env>(env));
27
}
28
}
29
30
template
<
typename
ExecEnvPolicy,
typename
Env, Kokkos::ExecutionSpace Exec>
31
using
join_env_with_exec_t
=
decltype
(
join_env_with_exec<ExecEnvPolicy>
(std::declval<Env>(), std::declval<Exec>()));
32
39
template
<
typename
ExecEnvPolicy,
typename
Env>
40
constexpr
auto
extend_env_with_exec
(Env&& env)
noexcept
{
41
if
constexpr
(std::same_as<ExecEnvPolicy, WithExecEnvPolicy>) {
42
auto
ref =
Impl::get_exec
(env);
43
return
stdexec::__env::__join(
44
stdexec::prop{
Impl::get_exec
, std::move(ref)}, stdexec::__fwd_env(std::forward<Env>(env)));
45
}
else
{
46
return
stdexec::__fwd_env(std::forward<Env>(env));
47
}
48
}
49
50
template
<
typename
ExecEnvPolicy,
typename
Env>
51
using
extend_env_with_exec_t
=
decltype
(
extend_env_with_exec<ExecEnvPolicy>
(std::declval<Env>()));
52
54
template
<
typename
Env>
55
using
extend_env_with_exec_policy_t
=
56
std::conditional_t<stdexec::__queryable_with<Env, Impl::get_exec_t>,
WithExecEnvPolicy
,
WithoutExecEnvPolicy
>;
57
58
}
// namespace Kokkos::Execution::ExecutionSpaceImpl
59
60
#endif
// KOKKOS_EXECUTION_EXECUTION_SPACE_ENV_HPP
get_exec.hpp
stdexec.hpp
Kokkos::Execution::ExecutionSpaceImpl
Definition
execution_space.hpp:22
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:51
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::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:31
Kokkos::Execution::ExecutionSpaceImpl::extend_env_with_exec
constexpr auto extend_env_with_exec(Env &&env) noexcept
Definition
env.hpp:40
Kokkos::Execution::Impl::get_exec
constexpr get_exec_t get_exec
Definition
get_exec.hpp:19
Kokkos::Execution::ExecutionSpaceImpl::WithExecEnvPolicy
Definition
env.hpp:10
Kokkos::Execution::ExecutionSpaceImpl::WithoutExecEnvPolicy
Definition
env.hpp:11
Kokkos::Execution::Impl::ExecutionSpaceRef
Wrap a Kokkos execution space to make it cheap to copy/move in new environments.
Definition
get_exec.hpp:47
kokkos-execution
execution_space
env.hpp
Generated on
for kokkos-execution by
1.18.0