OpenVDB 13.1.0
Loading...
Searching...
No Matches
MallocResource Class Reference

Synchronous device memory resource backed by cudaMalloc/cudaFree. Models only the Resource concept: it never touches stream-ordered allocation, so it works on devices without memory-pool support (cudaDevAttrMemoryPoolsSupported == 0), where DeviceResource's cudaMallocAsync path fails by design. Pair with AsyncFromSync to drive the stream-ordered builders on such a device. More...

#include <nanovdb/cuda/DeviceResource.h>

Public Member Functions

void * allocate (size_t bytes, size_t)
 Allocates bytes with cudaMalloc; valid on every stream when this returns. A zero request returns nullptr.
void deallocate (void *p, size_t, size_t)
 Frees p with cudaFree; the caller guarantees that device work touching the memory has completed.

Static Public Attributes

static constexpr size_t DEFAULT_ALIGNMENT = 256

Detailed Description

Synchronous device memory resource backed by cudaMalloc/cudaFree. Models only the Resource concept: it never touches stream-ordered allocation, so it works on devices without memory-pool support (cudaDevAttrMemoryPoolsSupported == 0), where DeviceResource's cudaMallocAsync path fails by design. Pair with AsyncFromSync to drive the stream-ordered builders on such a device.

Member Function Documentation

◆ allocate()

void * allocate ( size_t bytes,
size_t  )
inline

Allocates bytes with cudaMalloc; valid on every stream when this returns. A zero request returns nullptr.

◆ deallocate()

void deallocate ( void * p,
size_t ,
size_t  )
inline

Frees p with cudaFree; the caller guarantees that device work touching the memory has completed.

Member Data Documentation

◆ DEFAULT_ALIGNMENT

size_t DEFAULT_ALIGNMENT = 256
staticconstexpr