11 #ifndef CUBBYFLOW_CUDA_ARRAY_VIEW_IMPL_HPP 12 #define CUBBYFLOW_CUDA_ARRAY_VIEW_IMPL_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 18 template <
typename T,
size_t N>
19 CUDAArrayView<T, N>::CUDAArrayView() : Base()
24 template <
typename T,
size_t N>
25 CUDAArrayView<T, N>::CUDAArrayView(T* ptr,
const CUDAStdArray<size_t, N>& size)
31 template <
typename T,
size_t N>
33 CUDAArrayView<T, N>::CUDAArrayView(
34 typename std::enable_if<(M == 1), T>::type* ptr,
size_t size)
35 : CUDAArrayView(ptr, CUDAStdArray<size_t, N>{ size })
40 template <
typename T,
size_t N>
41 CUDAArrayView<T, N>::CUDAArrayView(CUDAArray<T, N>& other) : CUDAArrayView{}
46 template <
typename T,
size_t N>
47 CUDAArrayView<T, N>::CUDAArrayView(
const CUDAArrayView& other)
52 template <
typename T,
size_t N>
53 CUDAArrayView<T, N>::CUDAArrayView(CUDAArrayView&& other) noexcept
56 *
this = std::move(other);
59 template <
typename T,
size_t N>
60 CUDAArrayView<T, N>& CUDAArrayView<T, N>::operator=(
const CUDAArrayView& other)
66 template <
typename T,
size_t N>
67 CUDAArrayView<T, N>& CUDAArrayView<T, N>::operator=(
68 CUDAArrayView&& other) noexcept
71 other.SetPtrAndSize(
nullptr, CUDAStdArray<size_t, N>{});
75 template <
typename T,
size_t N>
76 void CUDAArrayView<T, N>::Set(CUDAArray<T, N>& other)
81 template <
typename T,
size_t N>
82 void CUDAArrayView<T, N>::Set(
const CUDAArrayView& other)
87 template <
typename T,
size_t N>
90 CUDAFill(
data(), val);
93 template <
typename T,
size_t N>
94 CUDAArrayView<const T, N>::CUDAArrayView() : Base()
99 template <
typename T,
size_t N>
100 CUDAArrayView<const T, N>::CUDAArrayView(
const T* ptr,
101 const CUDAStdArray<size_t, N>& size)
107 template <
typename T,
size_t N>
109 CUDAArrayView<const T, N>::CUDAArrayView(
110 const typename std::enable_if<(M == 1), T>::type* ptr,
size_t size)
111 : CUDAArrayView(ptr, CUDAStdArray<size_t, N>{ size })
116 template <
typename T,
size_t N>
117 CUDAArrayView<const T, N>::CUDAArrayView(
const CUDAArray<T, N>& other)
123 template <
typename T,
size_t N>
124 CUDAArrayView<const T, N>::CUDAArrayView(
const CUDAArrayView<T, N>& other)
129 template <
typename T,
size_t N>
130 CUDAArrayView<const T, N>::CUDAArrayView(
const CUDAArrayView& other)
135 template <
typename T,
size_t N>
136 CUDAArrayView<const T, N>::CUDAArrayView(CUDAArrayView&& other) noexcept
139 *
this = std::move(other);
142 template <
typename T,
size_t N>
143 CUDAArrayView<const T, N>& CUDAArrayView<const T, N>::operator=(
144 const CUDAArrayView<T, N>& other)
150 template <
typename T,
size_t N>
151 CUDAArrayView<const T, N>& CUDAArrayView<const T, N>::operator=(
152 const CUDAArrayView& other)
158 template <
typename T,
size_t N>
159 CUDAArrayView<const T, N>& CUDAArrayView<const T, N>::operator=(
160 CUDAArrayView&& other) noexcept
163 other.SetPtrAndSize(
nullptr, CUDAStdArray<size_t, N>{});
167 template <
typename T,
size_t N>
168 void CUDAArrayView<const T, N>::Set(
const CUDAArray<T, N>& other)
173 template <
typename T,
size_t N>
174 void CUDAArrayView<const T, N>::Set(
const CUDAArrayView<T, N>& other)
179 template <
typename T,
size_t N>
180 void CUDAArrayView<const T, N>::Set(
const CUDAArrayView& other)
void Set(Array< T, N > &other)
Definition: ArrayView-Impl.hpp:74
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
Pointer data()
Definition: ArrayBase-Impl.hpp:39
void SetPtrAndSize(Pointer ptr, size_t ni, Args... args)
Definition: ArrayBase-Impl.hpp:250