10#include <Kokkos_Core.hpp>
12#include "ddc/detail/kokkos.hpp"
13#include "ddc/discrete_domain.hpp"
14#include "ddc/discrete_element.hpp"
16namespace ddc::detail {
18template <
class ExecSpace,
class... DDims>
19auto ddc_to_kokkos_execution_policy(
20 ExecSpace
const& execution_space,
23 using work_tag = std::
24 conditional_t<need_annotated_operator<ExecSpace>(), use_annotated_operator,
void>;
25 using index_type = Kokkos::IndexType<DiscreteElementType>;
26 if constexpr (
sizeof...(DDims) == 0) {
27 return Kokkos::RangePolicy<ExecSpace, work_tag, index_type>(execution_space, 0, 1);
29 DiscreteElement<DDims...>
const ddc_begin = domain.front();
30 DiscreteElement<DDims...>
const ddc_end = domain.front() + domain.extents();
31 if constexpr (
sizeof...(DDims) == 1) {
32 std::size_t
const begin = ddc_begin.uid();
33 std::size_t
const end = ddc_end.uid();
35 RangePolicy<ExecSpace, work_tag, index_type>(execution_space, begin, end);
37 using iteration_pattern = Kokkos::
38 Rank<
sizeof...(DDims), Kokkos::Iterate::Right, Kokkos::Iterate::Right>;
39 Kokkos::Array<std::size_t,
sizeof...(DDims)>
const begin {
40 ddc::uid<DDims>(ddc_begin)...};
41 Kokkos::Array<std::size_t,
sizeof...(DDims)>
const end {
ddc::uid<DDims>(ddc_end)...};
42 return Kokkos::MDRangePolicy<
46 index_type>(execution_space, begin, end);
friend class DiscreteDomain
The top-level namespace of DDC.