Default stream-ordered device memory resource. Allocations are made with cudaMallocAsync and freed with cudaFreeAsync via the util::cuda wrappers.
More...
#include <nanovdb/cuda/DeviceResource.h>
|
| void * | allocate_async (size_t bytes, size_t, cudaStream_t stream) |
| | Stream-ordered allocation.
|
| void | deallocate_async (void *p, size_t, size_t, cudaStream_t stream) |
| | Stream-ordered deallocation.
|
| void * | allocate (size_t bytes, size_t alignment) |
| | Synchronous allocation; the returned memory is immediately valid on every stream.
|
| void | deallocate (void *p, size_t bytes, size_t alignment) |
| | Synchronous deallocation; the caller guarantees that device work touching the memory has completed.
|
Default stream-ordered device memory resource. Allocations are made with cudaMallocAsync and freed with cudaFreeAsync via the util::cuda wrappers.
- Note
- Models the AsyncResource concept, which refines the synchronous Resource concept (as in CCCL's cuda::mr): the instance methods provide both the stream-ordered allocate_async / deallocate_async and the synchronous allocate / deallocate. The type is stateless, so a default-constructed instance adds no overhead.
◆ allocate()
| void * allocate |
( |
size_t | bytes, |
|
|
size_t | alignment ) |
|
inline |
Synchronous allocation; the returned memory is immediately valid on every stream.
- Parameters
-
| bytes | number of bytes to allocate |
| alignment | requested alignment |
◆ allocate_async()
| void * allocate_async |
( |
size_t | bytes, |
|
|
size_t | , |
|
|
cudaStream_t | stream ) |
|
inline |
Stream-ordered allocation.
- Parameters
-
| bytes | number of bytes to allocate |
| stream | cuda stream the allocation is ordered on |
- Note
- the alignment parameter is unnamed: cudaMallocAsync always 256B-aligns
◆ deallocate()
| void deallocate |
( |
void * | p, |
|
|
size_t | bytes, |
|
|
size_t | alignment ) |
|
inline |
Synchronous deallocation; the caller guarantees that device work touching the memory has completed.
- Parameters
-
| p | pointer previously returned by allocate or allocate_async |
| bytes | size of the allocation in bytes |
| alignment | alignment of the allocation in bytes |
◆ deallocate_async()
| void deallocate_async |
( |
void * | p, |
|
|
size_t | , |
|
|
size_t | , |
|
|
cudaStream_t | stream ) |
|
inline |
Stream-ordered deallocation.
- Parameters
-
| p | pointer previously returned by allocate_async |
| stream | cuda stream the deallocation is ordered on |
◆ operator!=
◆ operator==
Stateless: memory allocated through one instance may be deallocated through any other, so every two instances compare equal (the equality cuda::mr's resource concepts require).
◆ DEFAULT_ALIGNMENT
| size_t DEFAULT_ALIGNMENT = 256 |
|
staticconstexpr |