37 #ifndef PCL_GPU_CONTAINER_DEVICE_ARRAY_IMPL_HPP_
38 #define PCL_GPU_CONTAINER_DEVICE_ARRAY_IMPL_HPP_
102 std::size_t device_begin_offset,
103 std::size_t num_elements)
105 std::size_t begin_byte_offset = device_begin_offset *
sizeof(T);
106 std::size_t num_bytes = num_elements *
sizeof(T);
120 std::size_t device_begin_offset,
121 std::size_t num_elements)
const
123 std::size_t begin_byte_offset = device_begin_offset *
sizeof(T);
124 std::size_t num_bytes = num_elements *
sizeof(T);
151 return sizeBytes() / elem_size;
158 return DeviceMemory::ptr<T>();
165 return DeviceMemory::ptr<T>();
173 upload(&data[0], data.size());
201 std::size_t stepBytes)
242 std::size_t host_step,
261 upload(&data[0], cols * elem_size, data.size() / cols, cols);
270 data.resize(cols() * rows());
272 download(&data[0], colsBytes());
286 return DeviceMemory2D::ptr<T>(y);
293 return DeviceMemory2D::ptr<T>(y);
std::size_t elem_step() const
Returns step in elements.
int rows() const
Returns number of rows.
DeviceArray2D & operator=(const DeviceArray2D &other)
Assignment operator.
void swap(DeviceArray2D &other_arg)
Performs swap of data pointed with another device array.
void release()
Decrements reference counter and releases internal buffer if needed.
void upload(const void *host_ptr, std::size_t host_step, int rows, int cols)
Uploads data to internal buffer in GPU memory.
int cols() const
Returns number of elements in each row.
void create(int rows, int cols)
Allocates internal buffer in GPU memory.
T * ptr(int y=0)
Returns pointer to given row in internal buffer.
void download(void *host_ptr, std::size_t host_step) const
Downloads data from internal buffer to CPU memory.
DeviceArray2D()
Empty constructor.
void copyTo(DeviceArray2D &other) const
Performs data copying.
DeviceArray()
Empty constructor.
void upload(const T *host_ptr, std::size_t size)
Uploads data to internal buffer in GPU memory.
std::size_t size() const
Returns size in elements.
void copyTo(DeviceArray &other) const
Performs data copying.
void download(T *host_ptr) const
Downloads data from internal buffer to CPU memory.
DeviceArray & operator=(const DeviceArray &other)
Assignment operator.
void swap(DeviceArray &other_arg)
Performs swap of data pointed with another device array.
void release()
Decrements reference counter and releases internal buffer if needed.
void create(std::size_t size)
Allocates internal buffer in GPU memory.
T * ptr()
Returns pointer for internal buffer in GPU memory.
void swap(DeviceMemory2D &other_arg)
Performs swap of data pointed with another device memory.
std::size_t step() const
Returns stride between two consecutive rows in bytes for internal buffer.
void download(void *host_ptr_arg, std::size_t host_step_arg) const
Downloads data from internal buffer to CPU memory.
void create(int rows_arg, int colsBytes_arg)
Allocates internal buffer in GPU memory.
int colsBytes() const
Returns number of bytes in each row.
int rows() const
Returns number of rows.
void upload(const void *host_ptr_arg, std::size_t host_step_arg, int rows_arg, int colsBytes_arg)
Uploads data to internal buffer in GPU memory.
DeviceMemory2D & operator=(const DeviceMemory2D &other_arg)
Assignment operator.
void release()
Decrements reference counter and releases internal buffer if needed.
void copyTo(DeviceMemory2D &other) const
Performs data copying.
void swap(DeviceMemory &other_arg)
Performs swap of data pointed with another device memory.
DeviceMemory & operator=(const DeviceMemory &other_arg)
Assignment operator.
void copyTo(DeviceMemory &other) const
Performs data copying.
void release()
Decrements reference counter and releases internal buffer if needed.
void download(void *host_ptr_arg) const
Downloads data from internal buffer to CPU memory.
void upload(const void *host_ptr_arg, std::size_t sizeBytes_arg)
Uploads data to internal buffer in GPU memory.
void create(std::size_t sizeBytes_arg)
Allocates internal buffer in GPU memory.