kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
get_exec.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_GET_EXEC_HPP
2
#define KOKKOS_EXECUTION_IMPL_GET_EXEC_HPP
3
4
#include "Kokkos_Macros.hpp"
5
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
6
import
kokkos.core;
7
#else
8
# include "Kokkos_Core.hpp"
9
#endif
10
11
#include "
kokkos-execution/impl/sender_introspection.hpp
"
12
13
namespace
Kokkos::Execution::Impl
{
14
20
struct
get_exec_t
:
public
stdexec::__query<get_exec_t> {
21
using
stdexec::__query<
get_exec_t
>::operator();
22
};
23
24
inline
constexpr
get_exec_t
get_exec
{};
25
26
template
<
typename
... Args>
27
struct
ExecOf
;
28
30
template
<stdexec::sender Sndr,
typename
... Env>
31
struct
ExecOf
<Sndr, Env...> {
32
using
type
=
typename
completion_scheduler_of_t
<stdexec::set_value_t, Sndr, Env...>
::execution_space
;
33
};
34
36
template
<stdexec::__queryable_with<get_exec_t> T>
37
struct
ExecOf
<T> {
38
using
type
=
typename
std::remove_cvref_t<stdexec::__query_result_t<T, get_exec_t>>
::execution_space
;
39
};
40
41
template
<
typename
... Args>
42
using
exec_of_t
=
typename
ExecOf
<Args...>::type;
43
51
template
<Kokkos::ExecutionSpace Exec>
52
struct
ExecutionSpaceRef
{
53
using
execution_space
= Exec;
54
55
execution_space
const
*
m_exec_ptr
;
56
57
explicit
constexpr
ExecutionSpaceRef
(
const
execution_space
& exec) noexcept
58
:
m_exec_ptr
(&exec) {
59
}
60
61
ExecutionSpaceRef
() =
delete
;
62
ExecutionSpaceRef
(
const
ExecutionSpaceRef
&)
noexcept
=
default
;
63
ExecutionSpaceRef
&
operator=
(
const
ExecutionSpaceRef
&)
noexcept
=
default
;
64
ExecutionSpaceRef
(
ExecutionSpaceRef
&&) noexcept = default;
65
ExecutionSpaceRef
& operator=(
ExecutionSpaceRef
&&) noexcept = default;
66
~
ExecutionSpaceRef
() noexcept = default;
67
68
const
execution_space
&
get
() const noexcept {
69
return
*
m_exec_ptr
;
70
}
71
72
friend
constexpr
auto
operator<=>
(
const
ExecutionSpaceRef
&,
const
ExecutionSpaceRef
&)
noexcept
=
default
;
73
74
[[nodiscard]]
75
constexpr
const
ExecutionSpaceRef
&
query
(
const
get_exec_t
&)
const
noexcept
{
76
return
*
this
;
77
}
78
};
79
80
}
// namespace Kokkos::Execution::Impl
81
82
#endif
// KOKKOS_EXECUTION_IMPL_GET_EXEC_HPP
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::completion_scheduler_of_t
std::invoke_result_t< stdexec::get_completion_scheduler_t< Tag >, stdexec::env_of_t< Sndr >, Env... > completion_scheduler_of_t
Retrieve the completion scheduler for a given completion tag.
Definition
sender_introspection.hpp:18
Kokkos::Execution::Impl::get_exec
constexpr get_exec_t get_exec
Definition
get_exec.hpp:24
Kokkos::Execution::Impl::exec_of_t
typename ExecOf< Args... >::type exec_of_t
Definition
get_exec.hpp:42
sender_introspection.hpp
Kokkos::Execution::Impl::ExecOf< Sndr, Env... >::type
typename completion_scheduler_of_t< stdexec::set_value_t, Sndr, Env... >::execution_space type
Definition
get_exec.hpp:32
Kokkos::Execution::Impl::ExecOf< T >::type
typename std::remove_cvref_t< stdexec::__query_result_t< T, get_exec_t > >::execution_space type
Definition
get_exec.hpp:38
Kokkos::Execution::Impl::ExecOf
Definition
get_exec.hpp:27
Kokkos::Execution::Impl::ExecutionSpaceRef::operator=
ExecutionSpaceRef & operator=(const ExecutionSpaceRef &) noexcept=default
Kokkos::Execution::Impl::ExecutionSpaceRef::execution_space
Exec execution_space
Definition
get_exec.hpp:53
Kokkos::Execution::Impl::ExecutionSpaceRef::m_exec_ptr
execution_space const * m_exec_ptr
Definition
get_exec.hpp:55
Kokkos::Execution::Impl::ExecutionSpaceRef::ExecutionSpaceRef
ExecutionSpaceRef(const ExecutionSpaceRef &) noexcept=default
Kokkos::Execution::Impl::ExecutionSpaceRef::ExecutionSpaceRef
ExecutionSpaceRef(ExecutionSpaceRef &&) noexcept=default
Kokkos::Execution::Impl::ExecutionSpaceRef::operator<=>
friend constexpr auto operator<=>(const ExecutionSpaceRef &, const ExecutionSpaceRef &) noexcept=default
Kokkos::Execution::Impl::ExecutionSpaceRef::ExecutionSpaceRef
ExecutionSpaceRef()=delete
Kokkos::Execution::Impl::ExecutionSpaceRef::get
const execution_space & get() const noexcept
Definition
get_exec.hpp:68
Kokkos::Execution::Impl::ExecutionSpaceRef::ExecutionSpaceRef
constexpr ExecutionSpaceRef(const execution_space &exec) noexcept
Definition
get_exec.hpp:57
Kokkos::Execution::Impl::ExecutionSpaceRef::query
constexpr const ExecutionSpaceRef & query(const get_exec_t &) const noexcept
Definition
get_exec.hpp:75
Kokkos::Execution::Impl::get_exec_t
Definition
get_exec.hpp:20
execution_space
Kokkos::DefaultExecutionSpace execution_space
kokkos-execution
impl
get_exec.hpp
Generated on
for kokkos-execution by
1.18.0