SimiLie
Loading...
Searching...
No Matches
unsecure_parallel_deepcopy.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include <ddc/ddc.hpp>
7
8namespace sil {
9
10namespace misc {
11
12namespace detail {
13
14template <class ChunkDst, class ChunkSrc>
15auto unsecure_parallel_deepcopy(ChunkDst&& dst, ChunkSrc&& src)
16{
17 static_assert(ddc::is_borrowed_chunk_v<ChunkDst>);
18 static_assert(ddc::is_borrowed_chunk_v<ChunkSrc>);
19 static_assert(
20 std::is_assignable_v<
21 ddc::chunk_reference_t<ChunkDst>,
22 ddc::chunk_reference_t<ChunkSrc>>,
23 "Not assignable");
24 Kokkos::deep_copy(dst.allocation_kokkos_view(), src.allocation_kokkos_view());
25 return dst.span_view();
26}
27
28template <class ExecSpace, class ChunkDst, class ChunkSrc>
29auto unsecure_parallel_deepcopy(ExecSpace const& execution_space, ChunkDst&& dst, ChunkSrc&& src)
30{
31 static_assert(ddc::is_borrowed_chunk_v<ChunkDst>);
32 static_assert(ddc::is_borrowed_chunk_v<ChunkSrc>);
33 static_assert(
34 std::is_assignable_v<
35 ddc::chunk_reference_t<ChunkDst>,
36 ddc::chunk_reference_t<ChunkSrc>>,
37 "Not assignable");
38 Kokkos::deep_copy(execution_space, dst.allocation_kokkos_view(), src.allocation_kokkos_view());
39 return dst.span_view();
40}
41
42} // namespace detail
43
44} // namespace misc
45
46} // namespace sil
The top-level namespace of SimiLie.
Definition csr.hpp:14