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 =
void;
24 using index_type = Kokkos::IndexType<DiscreteElementType>;
25 if constexpr (
sizeof...(DDims) == 0) {
26 return Kokkos::RangePolicy<ExecSpace, work_tag, index_type>(execution_space, 0, 1);
28 DiscreteElement<DDims...>
const ddc_begin = domain.front();
29 DiscreteElement<DDims...>
const ddc_end = domain.front() + domain.extents();
30 if constexpr (
sizeof...(DDims) == 1) {
31 std::size_t
const begin = ddc_begin.uid();
32 std::size_t
const end = ddc_end.uid();
34 RangePolicy<ExecSpace, work_tag, index_type>(execution_space, begin, end);
36 using iteration_pattern = Kokkos::
37 Rank<
sizeof...(DDims), Kokkos::Iterate::Right, Kokkos::Iterate::Right>;
38 Kokkos::Array<std::size_t,
sizeof...(DDims)>
const begin {
39 ddc::uid<DDims>(ddc_begin)...};
40 Kokkos::Array<std::size_t,
sizeof...(DDims)>
const end {
ddc::uid<DDims>(ddc_end)...};
41 return Kokkos::MDRangePolicy<
45 index_type>(execution_space, begin, end);
friend class DiscreteDomain
The top-level namespace of DDC.