Simple memory buffer using un-managed pinned host memory when compiled with NVCC. Obviously this class is making explicit used of CUDA so replace it with your own memory allocator if you are not using CUDA.
More...
#include <nanovdb/util/CudaDeviceBuffer.h>
|
| | CudaDeviceBuffer (uint64_t size=0) |
| | CudaDeviceBuffer (const CudaDeviceBuffer &)=delete |
| | Disallow copy-construction.
|
| | CudaDeviceBuffer (CudaDeviceBuffer &&other) noexcept |
| | Move copy-constructor.
|
| CudaDeviceBuffer & | operator= (const CudaDeviceBuffer &)=delete |
| | Disallow copy assignment operation.
|
| CudaDeviceBuffer & | operator= (CudaDeviceBuffer &&other) noexcept |
| | Move copy assignment operation.
|
| | ~CudaDeviceBuffer () |
| | Destructor frees memory on both the host and device.
|
| void | init (uint64_t size) |
| uint8_t * | data () const |
| uint8_t * | deviceData () const |
| void | deviceUpload (void *stream=0, bool sync=true) const |
| | Copy grid from the CPU/host to the GPU/device. If sync is false the memory copy is asynchronous!
|
| void | deviceDownload (void *stream=0, bool sync=true) const |
| | Copy grid from the GPU/device to the CPU/host. If sync is false the memory copy is asynchronous!
|
| uint64_t | size () const |
| | Returns the size in bytes of the raw memory buffer managed by this allocator.
|
| bool | empty () const |
| | Returns true if this allocator is empty, i.e. has no allocated memory.
|
| void | clear () |
| | De-allocate all memory managed by this allocator and set all pointer to NULL.
|
Simple memory buffer using un-managed pinned host memory when compiled with NVCC. Obviously this class is making explicit used of CUDA so replace it with your own memory allocator if you are not using CUDA.
- Note
- While CUDA's pinned host memory allows for asynchronous memory copy between host and device it is significantly slower then cached (un-pinned) memory on the host.
◆ CudaDeviceBuffer() [1/3]
| CudaDeviceBuffer |
( |
uint64_t | size = 0 | ) |
|
|
inline |
◆ CudaDeviceBuffer() [2/3]
| CudaDeviceBuffer |
( |
const CudaDeviceBuffer & | | ) |
|
|
delete |
Disallow copy-construction.
◆ CudaDeviceBuffer() [3/3]
| CudaDeviceBuffer |
( |
CudaDeviceBuffer && | other | ) |
|
|
inlinenoexcept |
◆ ~CudaDeviceBuffer()
Destructor frees memory on both the host and device.
◆ clear()
De-allocate all memory managed by this allocator and set all pointer to NULL.
◆ create()
◆ data()
- Warning
- Note that the pointer can be NULL is the allocator was not initialized!
◆ deviceData()
| uint8_t * deviceData |
( |
| ) |
const |
|
inline |
◆ deviceDownload()
| void deviceDownload |
( |
void * | stream = 0, |
|
|
bool | sync = true ) const |
|
inline |
Copy grid from the GPU/device to the CPU/host. If sync is false the memory copy is asynchronous!
◆ deviceUpload()
| void deviceUpload |
( |
void * | stream = 0, |
|
|
bool | sync = true ) const |
|
inline |
Copy grid from the CPU/host to the GPU/device. If sync is false the memory copy is asynchronous!
- Note
- This will allocate memory on the GPU/device if it is not already allocated
◆ empty()
Returns true if this allocator is empty, i.e. has no allocated memory.
◆ init()
| void init |
( |
uint64_t | size | ) |
|
|
inline |
◆ operator=() [1/2]
Disallow copy assignment operation.
◆ operator=() [2/2]
Move copy assignment operation.
◆ size()
Returns the size in bytes of the raw memory buffer managed by this allocator.