HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nanovdb::OclDeviceBuffer Class Reference

#include <CE_VDBCreate.h>

Public Member Functions

 OclDeviceBuffer (uint64_t size=0, bool host=true)
 Constructor. More...
 
 OclDeviceBuffer (const OclDeviceBuffer &)=delete
 Disallow copy-construction. More...
 
 OclDeviceBuffer (OclDeviceBuffer &&other) noexcept
 Move copy-constructor. More...
 
OclDeviceBufferoperator= (const OclDeviceBuffer &)=delete
 Disallow copy assignment operation. More...
 
OclDeviceBufferoperator= (OclDeviceBuffer &&other) noexcept
 Move copy assignment operation. More...
 
 ~OclDeviceBuffer ()
 Destructor frees memory on both the host and device. More...
 
void init (uint64_t size, bool host=true)
 Initialize buffer. More...
 
uint8_t * data () const
 Retuns a raw pointer to the host/CPU buffer managed by this allocator. More...
 
const cl::BufferdeviceData () const
 Retuns a cl::Buffer ref to the device/GPU buffer managed by this allocator. More...
 
void deviceUpload (void *stream=nullptr, bool sync=true)
 Upload this buffer from the host to the device, i.e. CPU -> GPU. More...
 
void deviceDownload (void *stream=nullptr, bool sync=true)
 Upload this buffer from the device to the host, i.e. GPU -> CPU. More...
 
uint64_t size () const
 Returns the size in bytes of the raw memory buffer managed by this allocator. More...
 
void clear ()
 De-allocate all memory managed by this allocator and set all pointers to NULL. More...
 
bool empty () const
 Returns true if this allocator is empty, i.e. has no allocated memory. More...
 
bool isEmpty () const
 Returns true if this allocator is empty, i.e. has no allocated memory. More...
 

Static Public Member Functions

static OclDeviceBuffer create (uint64_t size, bool host=true)
 Static factory method that return an instance of this buffer. More...
 

Detailed Description

Definition at line 59 of file CE_VDBCreate.h.

Constructor & Destructor Documentation

nanovdb::OclDeviceBuffer::OclDeviceBuffer ( uint64_t  size = 0,
bool  host = true 
)
inline

Constructor.

Parameters
sizebyte size of buffer to be initialized
hostIf true buffer is initialized only on the host/CPU, else on the device/GPU

Definition at line 75 of file CE_VDBCreate.h.

nanovdb::OclDeviceBuffer::OclDeviceBuffer ( const OclDeviceBuffer )
delete

Disallow copy-construction.

nanovdb::OclDeviceBuffer::OclDeviceBuffer ( OclDeviceBuffer &&  other)
inlinenoexcept

Move copy-constructor.

Definition at line 87 of file CE_VDBCreate.h.

nanovdb::OclDeviceBuffer::~OclDeviceBuffer ( )
inline

Destructor frees memory on both the host and device.

Definition at line 114 of file CE_VDBCreate.h.

Member Function Documentation

void nanovdb::OclDeviceBuffer::clear ( )
inline

De-allocate all memory managed by this allocator and set all pointers to NULL.

Definition at line 217 of file CE_VDBCreate.h.

OclDeviceBuffer nanovdb::OclDeviceBuffer::create ( uint64_t  size,
bool  host = true 
)
inlinestatic

Static factory method that return an instance of this buffer.

Parameters
sizebyte size of buffer to be initialized
hostIf true buffer is initialized only on the host/CPU, else on the device/GPU
Returns
An instance of this class using move semantics

Definition at line 167 of file CE_VDBCreate.h.

uint8_t* nanovdb::OclDeviceBuffer::data ( ) const
inline

Retuns a raw pointer to the host/CPU buffer managed by this allocator.

Warning
Note that the pointer can be NULL!

Definition at line 125 of file CE_VDBCreate.h.

const cl::Buffer& nanovdb::OclDeviceBuffer::deviceData ( ) const
inline

Retuns a cl::Buffer ref to the device/GPU buffer managed by this allocator.

Warning
Note that the pointer can be NULL!

Definition at line 129 of file CE_VDBCreate.h.

void nanovdb::OclDeviceBuffer::deviceDownload ( void stream = nullptr,
bool  sync = true 
)
inline

Upload this buffer from the device to the host, i.e. GPU -> CPU.

Parameters
streamoptional stream (defaults to stream 0) (never used)
syncif false the memory copy is asynchronous (never used)
Note
If the host/CPU buffer does not exist it is first allocated
Warning
Assumes that the device/GPU buffer already exists

Definition at line 204 of file CE_VDBCreate.h.

void nanovdb::OclDeviceBuffer::deviceUpload ( void stream = nullptr,
bool  sync = true 
)
inline

Upload this buffer from the host to the device, i.e. CPU -> GPU.

Parameters
streamoptional stream (defaults to stream 0) (never used)
syncif false the memory copy is asynchronous (never used)
Note
If the device/GPU buffer does not exist it is first allocated
Warning
Assumes that the host/CPU buffer already exists

Definition at line 191 of file CE_VDBCreate.h.

bool nanovdb::OclDeviceBuffer::empty ( ) const
inline

Returns true if this allocator is empty, i.e. has no allocated memory.

Definition at line 150 of file CE_VDBCreate.h.

void nanovdb::OclDeviceBuffer::init ( uint64_t  size,
bool  host = true 
)
inline

Initialize buffer.

Parameters
sizebyte size of buffer to be initialized
hostIf true buffer is initialized only on the host/CPU, else on the device/GPU
Note
All existing buffers are first cleared
Warning
size is expected to be non-zero. Use clear() clear buffer!

Definition at line 172 of file CE_VDBCreate.h.

bool nanovdb::OclDeviceBuffer::isEmpty ( ) const
inline

Returns true if this allocator is empty, i.e. has no allocated memory.

Definition at line 151 of file CE_VDBCreate.h.

OclDeviceBuffer& nanovdb::OclDeviceBuffer::operator= ( const OclDeviceBuffer )
delete

Disallow copy assignment operation.

OclDeviceBuffer& nanovdb::OclDeviceBuffer::operator= ( OclDeviceBuffer &&  other)
inlinenoexcept

Move copy assignment operation.

Definition at line 101 of file CE_VDBCreate.h.

uint64_t nanovdb::OclDeviceBuffer::size ( ) const
inline

Returns the size in bytes of the raw memory buffer managed by this allocator.

Definition at line 146 of file CE_VDBCreate.h.


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