Default host-pinned memory resource. Allocations are page-locked host memory (cudaMallocHost) that is both host-accessible and device-accessible, so it can serve as the host side of an asynchronous host<->device copy.
More...
#include <nanovdb/cuda/PinnedResource.h>
|
| void * | allocate (size_t bytes, size_t alignment) |
| | Synchronous allocation of page-locked host memory.
|
| void | deallocate (void *p, size_t bytes, size_t alignment) |
| | Synchronous deallocation.
|
Default host-pinned memory resource. Allocations are page-locked host memory (cudaMallocHost) that is both host-accessible and device-accessible, so it can serve as the host side of an asynchronous host<->device copy.
- Note
- This resource is synchronous: cudaMallocHost / cudaFreeHost synchronize the context, so it models the synchronous Resource concept (allocate / deallocate, no stream) rather than the stream-ordered AsyncResource concept. It is a seam so callers can substitute a pooled / genuinely stream-ordered pinned-host resource and avoid that synchronization.
◆ allocate()
| void * allocate |
( |
size_t | bytes, |
|
|
size_t | alignment ) |
|
inline |
Synchronous allocation of page-locked host memory.
- Parameters
-
| bytes | number of bytes to allocate |
| alignment | requested alignment (ignored; cudaMallocHost is page-aligned) |
◆ deallocate()
| void deallocate |
( |
void * | p, |
|
|
size_t | bytes, |
|
|
size_t | alignment ) |
|
inline |
Synchronous deallocation.
- Parameters
-
| p | pointer previously returned by allocate |
| bytes | size passed to the matching allocate (unused) |
| alignment | alignment passed to the matching allocate (unused) |
◆ DEFAULT_ALIGNMENT
| size_t DEFAULT_ALIGNMENT = 256 |
|
staticconstexpr |
◆ HOST_ACCESSIBLE
| bool HOST_ACCESSIBLE = true |
|
staticconstexpr |