41 #include <pcl/gpu/containers/device_array.h>
42 #include <pcl/gpu/utils/safe_call.hpp>
54 cudaSafeCall( cudaHostRegister(ptr_, size, 0) );
55 cudaSafeCall( cudaStreamCreate(&stream_) );
60 cudaSafeCall( cudaHostRegister(ptr_, data.size(), 0) );
61 cudaSafeCall( cudaStreamCreate(&stream_) );
66 cudaSafeCall( cudaHostUnregister(ptr_) );
67 cudaSafeCall( cudaStreamDestroy(stream_) );
72 cudaSafeCall( cudaMemcpyAsync(ptr_, arr.
ptr(), arr.
sizeBytes(), cudaMemcpyDeviceToHost, stream_) );
77 cudaSafeCall( cudaMemcpy2DAsync(ptr_, arr.
cols(), arr.
ptr(), arr.
step(), arr.
colsBytes(), arr.
rows(), cudaMemcpyDeviceToHost, stream_) );
82 cudaSafeCall( cudaMemcpyAsync(arr.
ptr(), ptr_, arr.
size(), cudaMemcpyHostToDevice, stream_) );
87 cudaSafeCall( cudaMemcpy2DAsync(arr.
ptr(), arr.
step(), ptr_, arr.
cols(), arr.
colsBytes(), arr.
rows(), cudaMemcpyHostToDevice, stream_) );
92 cudaSafeCall( cudaStreamSynchronize(stream_) );
AsyncCopy(T *ptr, std::size_t size)
void upload(const DeviceArray2D< T > &arr) const
void download(const DeviceArray2D< T > &arr)
void download(const DeviceArray< T > &arr)
AsyncCopy(std::vector< T > &data)
void upload(const DeviceArray< T > &arr) const
int rows() const
Returns number of rows.
int cols() const
Returns number of elements in each row.
T * ptr(int y=0)
Returns pointer to given row in internal buffer.
std::size_t size() const
Returns size in elements.
T * ptr()
Returns pointer for internal buffer in GPU memory.
std::size_t step() const
Returns stride between two consecutive rows in bytes for internal buffer.
int colsBytes() const
Returns number of bytes in each row.
std::size_t sizeBytes() const