9#include <Kokkos_Core.hpp>
11#include "ddc/chunk_span.hpp"
12#include "ddc/kokkos_allocator.hpp"
19template <
class Space,
class ElementType,
class Support,
class Layout,
class MemorySpace>
22 ChunkSpan<ElementType, Support, Layout, MemorySpace>
const& src)
25 Kokkos::is_memory_space_v<Space> || Kokkos::is_execution_space_v<Space>,
26 "DDC: parameter \"Space\" must be either a Kokkos execution space or a memory space");
28 std::is_same_v<Layout, Kokkos::layout_right>,
29 "DDC: parameter \"Layout\" must be a `layout_right`");
32 KokkosAllocator<std::remove_const_t<ElementType>,
typename Space::memory_space>());
38template <
class ElementType,
class Support,
class Layout,
class MemorySpace>
41 return create_mirror(Kokkos::HostSpace(), src);
47template <
class Space,
class ElementType,
class Support,
class Layout,
class MemorySpace>
50 ChunkSpan<ElementType, Support, Layout, MemorySpace>
const& src)
53 Kokkos::is_memory_space_v<Space> || Kokkos::is_execution_space_v<Space>,
54 "DDC: parameter \"Space\" must be either a Kokkos execution space or a memory space");
56 std::is_same_v<Layout, Kokkos::layout_right>,
57 "DDC: parameter \"Layout\" must be a `layout_right`");
58 Chunk chunk = create_mirror(space, src);
59 parallel_deepcopy(chunk, src);
66template <
class ElementType,
class Support,
class Layout,
class MemorySpace>
69 return create_mirror_and_copy(Kokkos::HostSpace(), src);
75template <
class Space,
class ElementType,
class Support,
class Layout,
class MemorySpace>
78 ChunkSpan<ElementType, Support, Layout, MemorySpace>
const& src)
81 !std::is_const_v<ElementType>,
82 "DDC: parameter \"ElementType\" must not be `const`");
84 Kokkos::is_memory_space_v<Space> || Kokkos::is_execution_space_v<Space>,
85 "DDC: parameter \"Space\" must be either a Kokkos execution space or a memory space");
87 std::is_same_v<Layout, Kokkos::layout_right>,
88 "DDC: parameter \"Layout\" must be a `layout_right`");
89 if constexpr (Kokkos::SpaceAccessibility<Space, MemorySpace>::accessible) {
92 return create_mirror(space, src);
99template <
class ElementType,
class Support,
class Layout,
class MemorySpace>
102 return create_mirror_view(Kokkos::HostSpace(), src);
108template <
class Space,
class ElementType,
class Support,
class Layout,
class MemorySpace>
111 ChunkSpan<ElementType, Support, Layout, MemorySpace>
const& src)
114 Kokkos::is_memory_space_v<Space> || Kokkos::is_execution_space_v<Space>,
115 "DDC: parameter \"Space\" must be either a Kokkos execution space or a memory space");
117 std::is_same_v<Layout, Kokkos::layout_right>,
118 "DDC: parameter \"Layout\" must be a `layout_right`");
119 if constexpr (Kokkos::SpaceAccessibility<Space, MemorySpace>::accessible) {
122 return create_mirror_and_copy(space, src);
129template <
class ElementType,
class Support,
class Layout,
class MemorySpace>
132 return create_mirror_view_and_copy(Kokkos::HostSpace(), src);
The top-level namespace of DDC.
auto create_mirror_view_and_copy(ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
Equivalent to create_mirror_view_and_copy(Kokkos::HostSpace(), src).
auto create_mirror_view(ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
Equivalent to create_mirror_view(Kokkos::HostSpace(), src).
auto create_mirror_view_and_copy(Space const &space, ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
auto create_mirror_and_copy(Space const &space, ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
auto create_mirror(ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
Equivalent to create_mirror(Kokkos::HostSpace(), src).
auto create_mirror_and_copy(ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
Equivalent to create_mirror_and_copy(Kokkos::HostSpace(), src).
auto create_mirror(Space const &space, ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)
auto create_mirror_view(Space const &space, ChunkSpan< ElementType, Support, Layout, MemorySpace > const &src)