27 enum { elem_size =
sizeof(T) };
52 void create(
size_t size);
66 void upload(
const T *host_ptr,
size_t size);
71 void download(T *host_ptr)
const;
77 void upload(
const std::vector<T, A>& data);
83 void download(std::vector<T, A>& data)
const;
102 operator const T*()
const;
124 enum { elem_size =
sizeof(T) };
141 DeviceArray2D(
int rows,
int cols,
void *data,
size_t stepBytes);
153 void create(
int rows,
int cols);
169 void upload(
const void *host_ptr,
size_t host_step,
int rows,
int cols);
175 void download(
void *host_ptr,
size_t host_step)
const;
187 void upload(
const std::vector<T, A>& data,
int cols);
194 void download(std::vector<T, A>& data,
int& cols)
const;
204 const T* ptr(
int y = 0)
const;
212 operator const T*()
const;
221 size_t elem_step()
const;
239 { DeviceMemory::operator=(other);
return *
this; }
242 { DeviceMemory::create(size * elem_size); }
244 { DeviceMemory::release(); }
247 { DeviceMemory::copyTo(other); }
249 { DeviceMemory::upload(host_ptr, size * elem_size); }
251 { DeviceMemory::download( host_ptr ); }
272 { DeviceMemory2D::operator=(other);
return *
this; }
275 { DeviceMemory2D::create(rows, cols * elem_size); }
277 { DeviceMemory2D::release(); }
280 { DeviceMemory2D::copyTo(other); }
282 { DeviceMemory2D::upload(host_ptr, host_step, rows, cols * elem_size); }
284 { DeviceMemory2D::download( host_ptr, host_step ); }
287 { upload(&data[0], cols * elem_size, data.size()/cols, cols); }
290 { elem_step = cols(); data.resize(cols() * rows());
if (!data.empty()) download(&data[0], colsBytes()); }