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.
|
|
| static void * | allocateAsync (size_t bytes, size_t alignment, cudaStream_t stream) |
| static void | deallocateAsync (void *p, size_t bytes, size_t alignment, cudaStream_t stream) |
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. The static allocateAsync / deallocateAsync methods are deprecated.
◆ 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
◆ allocateAsync()
| void * allocateAsync |
( |
size_t | bytes, |
|
|
size_t | alignment, |
|
|
cudaStream_t | stream ) |
|
inlinestatic |
◆ 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 |
◆ deallocateAsync()
| void deallocateAsync |
( |
void * | p, |
|
|
size_t | bytes, |
|
|
size_t | alignment, |
|
|
cudaStream_t | stream ) |
|
inlinestatic |
◆ DEFAULT_ALIGNMENT
| size_t DEFAULT_ALIGNMENT = 256 |
|
staticconstexpr |