11 #ifndef CUBBYFLOW_CUDA_ARRAY_VIEW_HPP 12 #define CUBBYFLOW_CUDA_ARRAY_VIEW_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 20 template <
typename T,
size_t N>
21 class CUDAArrayView final :
public CUDAArrayBase<T, N, CUDAArrayView<T, N>>
23 using Base = CUDAArrayBase<T, N, CUDAArrayView<T, N>>;
26 using Base::SetPtrAndSize;
31 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView();
33 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
34 T* ptr,
const CUDAStdArray<size_t, N>& size);
36 template <
size_t M = N>
37 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
38 typename std::enable_if<(M == 1), T>::type* ptr,
size_t size);
40 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(CUDAArray<T, N>& other);
42 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
const CUDAArrayView& other);
44 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(CUDAArrayView&& other) noexcept;
46 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView& operator=(
47 const CUDAArrayView& other);
49 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView& operator=(
50 CUDAArrayView&& other) noexcept;
52 CUBBYFLOW_CUDA_HOST_DEVICE
void Set(CUDAArray<T, N>& other);
54 CUBBYFLOW_CUDA_HOST_DEVICE
void Set(
const CUDAArrayView& other);
56 CUBBYFLOW_CUDA_HOST
void Fill(
const T& val);
59 template <
typename T,
size_t N>
60 class CUDAArrayView<const T, N> final
61 :
public CUDAArrayBase<const T, N, CUDAArrayView<const T, N>>
63 using Base = CUDAArrayBase<const T, N, CUDAArrayView<const T, N>>;
65 using Base::SetPtrAndSize;
70 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView();
72 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
73 const T* ptr,
const CUDAStdArray<size_t, N>& size);
75 template <
size_t M = N>
76 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
77 const typename std::enable_if<(M == 1), T>::type* ptr,
size_t size);
79 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
const CUDAArray<T, N>& other);
81 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
const CUDAArrayView<T, N>& other);
83 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(
const CUDAArrayView& other);
85 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView(CUDAArrayView&&) noexcept;
87 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView& operator=(
88 const CUDAArrayView<T, N>& other);
90 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView& operator=(
91 const CUDAArrayView& other);
93 CUBBYFLOW_CUDA_HOST_DEVICE CUDAArrayView& operator=(
94 CUDAArrayView&& other) noexcept;
96 CUBBYFLOW_CUDA_HOST_DEVICE
void Set(const CUDAArray<T, N>& other);
98 CUBBYFLOW_CUDA_HOST_DEVICE
void Set(const CUDAArrayView<T, N>& other);
100 CUBBYFLOW_CUDA_HOST_DEVICE
void Set(const CUDAArrayView& other);
104 using CUDAArrayView1 = CUDAArrayView<T, 1>;
107 using CUDAArrayView2 = CUDAArrayView<T, 2>;
110 using CUDAArrayView3 = CUDAArrayView<T, 3>;
113 using CUDAArrayView4 = CUDAArrayView<T, 4>;
116 using ConstCUDAArrayView1 = CUDAArrayView<const T, 1>;
119 using ConstCUDAArrayView2 = CUDAArrayView<const T, 2>;
122 using ConstCUDAArrayView3 = CUDAArrayView<const T, 3>;
125 using ConstCUDAArrayView4 = CUDAArrayView<const T, 4>;
128 #include <Core/CUDA/CUDAArrayView-Impl.hpp> Definition: pybind11Utils.hpp:20
void Fill(ArrayView< T, N > a, const Vector< size_t, N > &begin, const Vector< size_t, N > &end, const T &val)
Definition: ArrayUtils-Impl.hpp:19