DeviceMemory2D class More...
#include <device_memory.hpp>

Public Member Functions | |
| int | colsBytes () const |
| Returns number of bytes in each row. More... | |
| void | copyTo (DeviceMemory2D &other) const |
| Performs data copying. If destination size differs it will be reallocated. More... | |
| void | create (int rows_arg, int colsBytes_arg) |
| Allocates internal buffer in GPU memory. If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing. More... | |
| DeviceMemory2D () | |
| Empty constructor. More... | |
| DeviceMemory2D (const DeviceMemory2D &other_arg) | |
| Copy constructor. Just increments reference counter. More... | |
| DeviceMemory2D (int rows_arg, int colsBytes_arg) | |
| Allocates internal buffer in GPU memory. More... | |
| DeviceMemory2D (int rows_arg, int colsBytes_arg, void *data_arg, size_t step_arg) | |
| Initializes with user allocated buffer. Reference counting is disabled in this case. More... | |
| void | download (void *host_ptr_arg, size_t host_step_arg) const |
| Downloads data from internal buffer to CPU memory. User is resposible for correct host buffer size. More... | |
| bool | empty () const |
| Returns true if unallocated otherwise false. More... | |
| template<class U > | |
| operator PtrStep< U > () const | |
| Conversion to PtrStep for passing to kernel functions. More... | |
| template<class U > | |
| operator PtrStepSz< U > () const | |
| Conversion to PtrStepSz for passing to kernel functions. More... | |
| DeviceMemory2D & | operator= (const DeviceMemory2D &other_arg) |
| Assigment operator. Just increments reference counter. More... | |
| template<class T > | |
| T * | ptr (int y_arg=0) |
| Returns pointer to given row in internal buffer. More... | |
| template<class T > | |
| const T * | ptr (int y_arg=0) const |
| Returns constant pointer to given row in internal buffer. More... | |
| void | release () |
| Decrements reference counter and releases internal buffer if needed. More... | |
| int | rows () const |
| Returns number of rows. More... | |
| size_t | step () const |
| Returns stride between two consecutive rows in bytes for internal buffer. Step is stored always and everywhere in bytes!!! More... | |
| void | swap (DeviceMemory2D &other_arg) |
| Performs swap of data pointed with another device memory. More... | |
| void | upload (const void *host_ptr_arg, size_t host_step_arg, int rows_arg, int colsBytes_arg) |
| Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough. More... | |
| ~DeviceMemory2D () | |
| Destructor. More... | |
Private Attributes | |
| int | colsBytes_ |
| Width of the buffer in bytes. More... | |
| void * | data_ |
| Device pointer. More... | |
| int * | refcount_ |
| Pointer to reference counter in CPU memory. More... | |
| int | rows_ |
| Number of rows. More... | |
| size_t | step_ |
| Stride between two consecutive rows in bytes for internal buffer. Step is stored always and everywhere in bytes!!! More... | |
DeviceMemory2D class
Definition at line 109 of file device_memory.hpp.
| kfusion::cuda::DeviceMemory2D::DeviceMemory2D | ( | ) |
Empty constructor.
Definition at line 144 of file device_memory.cpp.
| kfusion::cuda::DeviceMemory2D::~DeviceMemory2D | ( | ) |
Destructor.
Definition at line 155 of file device_memory.cpp.
| kfusion::cuda::DeviceMemory2D::DeviceMemory2D | ( | int | rows_arg, |
| int | colsBytes_arg | ||
| ) |
Allocates internal buffer in GPU memory.
| rows_arg | number of rows to allocate |
| colsBytes_arg | width of the buffer in bytes |
Definition at line 146 of file device_memory.cpp.
| kfusion::cuda::DeviceMemory2D::DeviceMemory2D | ( | int | rows_arg, |
| int | colsBytes_arg, | ||
| void * | data_arg, | ||
| size_t | step_arg | ||
| ) |
Initializes with user allocated buffer. Reference counting is disabled in this case.
| rows_arg | number of rows |
| colsBytes_arg | width of the buffer in bytes |
| data_arg | pointer to buffer |
| stepBytes_arg | stride between two consecutive rows in bytes |
Definition at line 152 of file device_memory.cpp.
| kfusion::cuda::DeviceMemory2D::DeviceMemory2D | ( | const DeviceMemory2D & | other_arg | ) |
Copy constructor. Just increments reference counter.
Definition at line 158 of file device_memory.cpp.
| int kfusion::cuda::DeviceMemory2D::colsBytes | ( | ) | const |
Returns number of bytes in each row.
Definition at line 256 of file device_memory.cpp.
| void kfusion::cuda::DeviceMemory2D::copyTo | ( | DeviceMemory2D & | other | ) | const |
Performs data copying. If destination size differs it will be reallocated.
| other_arg | destination container |
Definition at line 220 of file device_memory.cpp.
| void kfusion::cuda::DeviceMemory2D::create | ( | int | rows_arg, |
| int | colsBytes_arg | ||
| ) |
Allocates internal buffer in GPU memory. If internal buffer was created before the function recreates it with new size. If new and old sizes are equal it does nothing.
| ptr_arg | number of rows to allocate |
| sizeBytes_arg | width of the buffer in bytes |
Definition at line 183 of file device_memory.cpp.
| void kfusion::cuda::DeviceMemory2D::download | ( | void * | host_ptr_arg, |
| size_t | host_step_arg | ||
| ) | const |
Downloads data from internal buffer to CPU memory. User is resposible for correct host buffer size.
| host_ptr_arg | pointer to host buffer to download |
| host_step_arg | stride between two consecutive rows in bytes for host buffer |
Definition at line 239 of file device_memory.cpp.
| bool kfusion::cuda::DeviceMemory2D::empty | ( | ) | const |
Returns true if unallocated otherwise false.
Definition at line 255 of file device_memory.cpp.
| kfusion::cuda::DeviceMemory2D::operator PtrStep< U > | ( | ) | const |
Conversion to PtrStep for passing to kernel functions.
| kfusion::cuda::DeviceMemory2D::operator PtrStepSz< U > | ( | ) | const |
Conversion to PtrStepSz for passing to kernel functions.
| kfusion::cuda::DeviceMemory2D & kfusion::cuda::DeviceMemory2D::operator= | ( | const DeviceMemory2D & | other_arg | ) |
Assigment operator. Just increments reference counter.
Definition at line 165 of file device_memory.cpp.
| T * kfusion::cuda::DeviceMemory2D::ptr | ( | int | y_arg = 0 | ) |
Returns pointer to given row in internal buffer.
| y_arg | row index |
Definition at line 239 of file device_memory.hpp.
| const T * kfusion::cuda::DeviceMemory2D::ptr | ( | int | y_arg = 0 | ) | const |
Returns constant pointer to given row in internal buffer.
| y_arg | row index |
Definition at line 240 of file device_memory.hpp.
| void kfusion::cuda::DeviceMemory2D::release | ( | ) |
Decrements reference counter and releases internal buffer if needed.
Definition at line 204 of file device_memory.cpp.
| int kfusion::cuda::DeviceMemory2D::rows | ( | ) | const |
Returns number of rows.
Definition at line 257 of file device_memory.cpp.
| size_t kfusion::cuda::DeviceMemory2D::step | ( | ) | const |
Returns stride between two consecutive rows in bytes for internal buffer. Step is stored always and everywhere in bytes!!!
Definition at line 258 of file device_memory.cpp.
| void kfusion::cuda::DeviceMemory2D::swap | ( | DeviceMemory2D & | other_arg | ) |
Performs swap of data pointed with another device memory.
| other | device memory to swap with |
Definition at line 245 of file device_memory.cpp.
| void kfusion::cuda::DeviceMemory2D::upload | ( | const void * | host_ptr_arg, |
| size_t | host_step_arg, | ||
| int | rows_arg, | ||
| int | colsBytes_arg | ||
| ) |
Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough.
| host_ptr_arg | pointer to host buffer to upload |
| host_step_arg | stride between two consecutive rows in bytes for host buffer |
| rows_arg | number of rows to upload |
| sizeBytes_arg | width of host buffer in bytes |
Definition at line 232 of file device_memory.cpp.
|
private |
Width of the buffer in bytes.
Definition at line 207 of file device_memory.hpp.
|
private |
Device pointer.
Definition at line 201 of file device_memory.hpp.
|
private |
Pointer to reference counter in CPU memory.
Definition at line 213 of file device_memory.hpp.
|
private |
Number of rows.
Definition at line 210 of file device_memory.hpp.
|
private |
Stride between two consecutive rows in bytes for internal buffer. Step is stored always and everywhere in bytes!!!
Definition at line 204 of file device_memory.hpp.