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 Support>
19auto ddc_to_kokkos_execution_policy(ExecSpace
const& execution_space, Support
const& domain)
21 using work_tag =
void;
22 using index_type = Kokkos::IndexType<DiscreteElementType>;
23 if constexpr (Support::rank() == 0) {
24 return Kokkos::RangePolicy<ExecSpace, work_tag, index_type>(execution_space, 0, 1);
26 if constexpr (Support::rank() == 1) {
27 return Kokkos::RangePolicy<
30 index_type>(execution_space, 0, domain.extents().value());
32 using iteration_pattern
33 = Kokkos::Rank<Support::rank(), Kokkos::Iterate::Right, Kokkos::Iterate::Right>;
34 Kokkos::Array<std::size_t, Support::rank()>
const begin {};
35 std::array
const end = detail::array(domain.extents());
36 Kokkos::Array<std::size_t, Support::rank()> end2;
37 for (
int i = 0; i < Support::rank(); ++i) {
40 return Kokkos::MDRangePolicy<
44 index_type>(execution_space, begin, end2);
The top-level namespace of DDC.