Public Types | Public Member Functions | List of all members
kfusion::cuda::DeviceArray2D< T > Class Template Reference

DeviceArray2D class More...

#include <device_array.hpp>

Inheritance diagram for kfusion::cuda::DeviceArray2D< T >:
Inheritance graph
[legend]

Public Types

enum  { elem_size = sizeof(T) }
 Element size. More...
 
typedef T type
 Element type. More...
 

Public Member Functions

int cols () const
 Returns number of elements in each row. More...
 
void copyTo (DeviceArray2D &other) const
 Performs data copying. If destination size differs it will be reallocated. More...
 
void create (int rows, int cols)
 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...
 
 DeviceArray2D ()
 Empty constructor. More...
 
 DeviceArray2D (int rows, int cols)
 Allocates internal buffer in GPU memory. More...
 
 DeviceArray2D (int rows, int cols, void *data, size_t stepBytes)
 Initializes with user allocated buffer. Reference counting is disabled in this case. More...
 
 DeviceArray2D (const DeviceArray2D &other)
 Copy constructor. Just increments reference counter. More...
 
void download (void *host_ptr, size_t host_step) const
 Downloads data from internal buffer to CPU memory. User is resposible for correct host buffer size. More...
 
template<class A >
void download (std::vector< T, A > &data, int &cols) const
 Downloads data from internal buffer to CPU memory. More...
 
size_t elem_step () const
 Returns step in elements. More...
 
 operator const T * () const
 Returns const pointer for internal buffer in GPU memory. More...
 
 operator T* ()
 Returns pointer for internal buffer in GPU memory. More...
 
DeviceArray2Doperator= (const DeviceArray2D &other)
 Assigment operator. Just increments reference counter. More...
 
T * ptr (int y=0)
 Returns pointer to given row in internal buffer. More...
 
const T * ptr (int y=0) const
 Returns const 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...
 
void swap (DeviceArray2D &other_arg)
 Performs swap of data pointed with another device array. More...
 
void upload (const void *host_ptr, size_t host_step, int rows, int cols)
 Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough. More...
 
template<class A >
void upload (const std::vector< T, A > &data, int cols)
 Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough. More...
 
- Public Member Functions inherited from kfusion::cuda::DeviceMemory2D
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 (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...
 
 DeviceMemory2D (const DeviceMemory2D &other_arg)
 Copy constructor. Just increments reference counter. 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...
 
DeviceMemory2Doperator= (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...
 

Detailed Description

template<class T>
class kfusion::cuda::DeviceArray2D< T >

DeviceArray2D class

Note
Typed container for pitched GPU memory with reference counting.
Author
Anatoly Baksheev

Definition at line 117 of file device_array.hpp.

Member Typedef Documentation

◆ type

template<class T>
typedef T kfusion::cuda::DeviceArray2D< T >::type

Element type.

Definition at line 121 of file device_array.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class T>
anonymous enum

Element size.

Enumerator
elem_size 

Definition at line 124 of file device_array.hpp.

Constructor & Destructor Documentation

◆ DeviceArray2D() [1/4]

template<class T >
kfusion::cuda::DeviceArray2D< T >::DeviceArray2D ( )
inline

Empty constructor.

Definition at line 267 of file device_array.hpp.

◆ DeviceArray2D() [2/4]

template<class T >
kfusion::cuda::DeviceArray2D< T >::DeviceArray2D ( int  rows,
int  cols 
)
inline

Allocates internal buffer in GPU memory.

Parameters
rowsnumber of rows to allocate
colsnumber of elements in each row

Definition at line 268 of file device_array.hpp.

◆ DeviceArray2D() [3/4]

template<class T >
kfusion::cuda::DeviceArray2D< T >::DeviceArray2D ( int  rows,
int  cols,
void *  data,
size_t  stepBytes 
)
inline

Initializes with user allocated buffer. Reference counting is disabled in this case.

Parameters
rowsnumber of rows
colsnumber of elements in each row
datapointer to buffer
stepBytesstride between two consecutive rows in bytes

Definition at line 269 of file device_array.hpp.

◆ DeviceArray2D() [4/4]

template<class T >
kfusion::cuda::DeviceArray2D< T >::DeviceArray2D ( const DeviceArray2D< T > &  other)
inline

Copy constructor. Just increments reference counter.

Definition at line 270 of file device_array.hpp.

Member Function Documentation

◆ cols()

template<class T >
int kfusion::cuda::DeviceArray2D< T >::cols ( ) const
inline

Returns number of elements in each row.

Definition at line 300 of file device_array.hpp.

◆ copyTo()

template<class T >
void kfusion::cuda::DeviceArray2D< T >::copyTo ( DeviceArray2D< T > &  other) const
inline

Performs data copying. If destination size differs it will be reallocated.

Parameters
otherdestination container

Definition at line 279 of file device_array.hpp.

◆ create()

template<class T >
void kfusion::cuda::DeviceArray2D< T >::create ( int  rows,
int  cols 
)
inline

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.

Parameters
rowsnumber of rows to allocate
colsnumber of elements in each row

Definition at line 274 of file device_array.hpp.

◆ download() [1/2]

template<class T >
void kfusion::cuda::DeviceArray2D< T >::download ( void *  host_ptr,
size_t  host_step 
) const
inline

Downloads data from internal buffer to CPU memory. User is resposible for correct host buffer size.

Parameters
host_ptrpointer to host buffer to download
host_stepstride between two consecutive rows in bytes for host buffer

Definition at line 283 of file device_array.hpp.

◆ download() [2/2]

template<class T>
template<class A >
void kfusion::cuda::DeviceArray2D< T >::download ( std::vector< T, A > &  data,
int &  cols 
) const
inline

Downloads data from internal buffer to CPU memory.

Parameters
datahost vector to download to
colsOutput stride in elements between two consecutive rows for host vector.

Definition at line 289 of file device_array.hpp.

◆ elem_step()

template<class T >
size_t kfusion::cuda::DeviceArray2D< T >::elem_step ( ) const
inline

Returns step in elements.

Definition at line 303 of file device_array.hpp.

◆ operator const T *()

template<class T >
kfusion::cuda::DeviceArray2D< T >::operator const T * ( ) const
inline

Returns const pointer for internal buffer in GPU memory.

Definition at line 298 of file device_array.hpp.

◆ operator T*()

template<class T >
kfusion::cuda::DeviceArray2D< T >::operator T* ( )
inline

Returns pointer for internal buffer in GPU memory.

Definition at line 297 of file device_array.hpp.

◆ operator=()

template<class T >
kfusion::cuda::DeviceArray2D< T > & kfusion::cuda::DeviceArray2D< T >::operator= ( const DeviceArray2D< T > &  other)
inline

Assigment operator. Just increments reference counter.

Definition at line 271 of file device_array.hpp.

◆ ptr() [1/2]

template<class T >
T * kfusion::cuda::DeviceArray2D< T >::ptr ( int  y = 0)
inline

Returns pointer to given row in internal buffer.

Parameters
y_argrow index

Definition at line 294 of file device_array.hpp.

◆ ptr() [2/2]

template<class T >
const T * kfusion::cuda::DeviceArray2D< T >::ptr ( int  y = 0) const
inline

Returns const pointer to given row in internal buffer.

Parameters
y_argrow index

Definition at line 295 of file device_array.hpp.

◆ release()

template<class T >
void kfusion::cuda::DeviceArray2D< T >::release ( )
inline

Decrements reference counter and releases internal buffer if needed.

Definition at line 276 of file device_array.hpp.

◆ rows()

template<class T >
int kfusion::cuda::DeviceArray2D< T >::rows ( ) const
inline

Returns number of rows.

Definition at line 301 of file device_array.hpp.

◆ swap()

template<class T >
void kfusion::cuda::DeviceArray2D< T >::swap ( DeviceArray2D< T > &  other_arg)

Performs swap of data pointed with another device array.

Parameters
otherdevice array to swap with

Definition at line 292 of file device_array.hpp.

◆ upload() [1/2]

template<class T >
void kfusion::cuda::DeviceArray2D< T >::upload ( const void *  host_ptr,
size_t  host_step,
int  rows,
int  cols 
)
inline

Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough.

Parameters
host_ptrpointer to host buffer to upload
host_stepstride between two consecutive rows in bytes for host buffer
rowsnumber of rows to upload
colsnumber of elements in each row

Definition at line 281 of file device_array.hpp.

◆ upload() [2/2]

template<class T>
template<class A >
void kfusion::cuda::DeviceArray2D< T >::upload ( const std::vector< T, A > &  data,
int  cols 
)
inline

Uploads data to internal buffer in GPU memory. It calls create() inside to ensure that intenal buffer size is enough.

Parameters
datahost vector to upload from
colsstride in elements between two consecutive rows for host buffer

Definition at line 286 of file device_array.hpp.


The documentation for this class was generated from the following file:


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:11