10#include <Kokkos_Core.hpp>
12#include "ddc/chunk_traits.hpp"
17
18
19
20
21template <
class ChunkDst,
class ChunkSrc>
24 static_assert(is_borrowed_chunk_v<ChunkDst>);
25 static_assert(is_borrowed_chunk_v<ChunkSrc>);
27 std::is_assignable_v<chunk_reference_t<ChunkDst>, chunk_reference_t<ChunkSrc>>,
29 static_assert(std::is_same_v<
decltype(dst.domain()),
decltype(src.domain())>);
30 assert(dst.domain() == src.domain());
31 Kokkos::deep_copy(dst.allocation_kokkos_view(), src.allocation_kokkos_view());
32 return dst.span_view();
36
37
38
39
40
41template <
class ExecSpace,
class ChunkDst,
class ChunkSrc>
42auto parallel_deepcopy(ExecSpace
const& execution_space, ChunkDst&& dst, ChunkSrc&& src)
44 static_assert(is_borrowed_chunk_v<ChunkDst>);
45 static_assert(is_borrowed_chunk_v<ChunkSrc>);
47 std::is_assignable_v<chunk_reference_t<ChunkDst>, chunk_reference_t<ChunkSrc>>,
50 std::is_same_v<
decltype(dst.domain()),
decltype(src.domain())>,
51 "ddc::parallel_deepcopy only supports domains whose dimensions are of the same order");
52 assert(dst.domain() == src.domain());
53 Kokkos::deep_copy(execution_space, dst.allocation_kokkos_view(), src.allocation_kokkos_view());
54 return dst.span_view();
The top-level namespace of DDC.
auto parallel_deepcopy(ChunkDst &&dst, ChunkSrc &&src)
Copy the content of a borrowed chunk into another.
auto parallel_deepcopy(ExecSpace const &execution_space, ChunkDst &&dst, ChunkSrc &&src)
Copy the content of a borrowed chunk into another.