kokkos-execution 0.0.1
Loading...
Searching...
No Matches
iteration_space.hpp
Go to the documentation of this file.
1#ifndef KOKKOS_EXECUTION_IMPL_ITERATION_SPACE_HPP
2#define KOKKOS_EXECUTION_IMPL_ITERATION_SPACE_HPP
3
4#include <type_traits>
5
6#include "Kokkos_Macros.hpp"
7#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
8import kokkos.core;
9import kokkos.execution.mdspan;
10#else
11# include "Kokkos_Core.hpp"
12#endif
13
15
16template <typename T>
17concept extents = Kokkos::detail::impl_is_extents_v<T>;
18
19template <typename T>
20concept range_slice = Kokkos::detail::is_range_slice<T>::value;
21
22template <typename T>
24 && Kokkos::detail::is_constant_wrapper<decltype(std::declval<T>().stride)>
25 && requires(const T& rgsl) { rgsl.stride == 1; };
26
28template <typename T>
29concept iteration_space = (extents<T> && requires { T::rank() == 1; }) || range_slice_with_default_stride<T>;
30
31template <typename T>
32concept execution_policy_or_iteration_space = Kokkos::ExecutionPolicy<T> || iteration_space<T>;
33
35template <std::integral T>
36constexpr auto make_iter_space(const T work_count) noexcept -> Kokkos::dims<1, T> {
37 return Kokkos::dims<1, T>{work_count};
38}
39
40} // namespace Kokkos::Execution::Impl
41
42#endif // KOKKOS_EXECUTION_IMPL_ITERATION_SPACE_HPP
Concept that constrains types that may represent an iteration space.
constexpr auto make_iter_space(const T work_count) noexcept -> Kokkos::dims< 1, T >
Make a valid iteration space from a work count.