OpenVDB 13.1.0
Loading...
Searching...
No Matches
DeviceResource.h File Reference
#include <cuda_runtime_api.h>
#include <nanovdb/util/cuda/Util.h>
#include <cstddef>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

class  DeviceResource
 Default stream-ordered device memory resource. Allocations are made with cudaMallocAsync and freed with cudaFreeAsync via the util::cuda wrappers. More...
struct  is_async_resource< R, class >
 Detection trait: is_async_resource<R>::value is true iff R models the stream-ordered AsyncResource concept, i.e. exposes allocate_async(size_t, size_t, cudaStream_t) and deallocate_async(void*, size_t, size_t, cudaStream_t). More...
struct  is_async_resource< R, std::void_t< decltype(std::declval< R & >().allocate_async(size_t{0}, size_t{0}, cudaStream_t{0})), decltype(std::declval< R & >().deallocate_async(std::declval< void * >(), size_t{0}, size_t{0}, cudaStream_t{0})), decltype(std::declval< R & >().allocate(size_t{0}, size_t{0})), decltype(std::declval< R & >().deallocate(std::declval< void * >(), size_t{0}, size_t{0}))> >
struct  is_host_accessible_resource< R, typename >
 Detection trait: is_host_accessible_resource<R>::value is true iff R declares static constexpr bool HOST_ACCESSIBLE = true, i.e. its allocations are mapped into the host address space (e.g. PinnedResource). Defaults to false: allocations are device-resident. More...
struct  is_host_accessible_resource< R, typename std::enable_if< bool(R::HOST_ACCESSIBLE)>::type >
struct  is_device_accessible_resource< R, typename >
 Companion detection: is_device_accessible_resource<R>::value is true iff R declares static constexpr bool DEVICE_ACCESSIBLE = / true, i.e. its allocations are also valid device addresses even though they are host-accessible (e.g. ManagedResource). A handle over such a resource exposes both accessor families. Purely device-resident resources do not need the marker: not being host-accessible already implies device residency. More...
struct  is_device_accessible_resource< R, typename std::enable_if< bool(R::DEVICE_ACCESSIBLE)>::type >
struct  is_resource< R, class >
 Detection trait: is_resource<R>::value is true iff R models the synchronous Resource concept, i.e. exposes allocate(size_t, size_t) and deallocate(void*, size_t, size_t). More...
struct  is_resource< R, std::void_t< decltype(std::declval< R & >().allocate(size_t{0}, size_t{0})), decltype(std::declval< R & >().deallocate(std::declval< void * >(), size_t{0}, size_t{0}))> >
struct  SyncFromAsync< Derived >
 CRTP base supplying the synchronous half of the resource concept in terms of the stream-ordered half, so a custom stream-ordered resource only has to write allocate_async and deallocate_async. More...
class  MallocResource
 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...
struct  AsyncFromSync< R >
 Wrapper presenting a synchronous resource as a stream-ordered one, so it can drive components that require the AsyncResource concept (TempPool and the GPU builders). More...
struct  ResourceRef< R >
 Non-owning reference to a memory resource that is itself a resource: copying the ref shares the underlying resource rather than copying it. More...

Namespaces

namespace  nanovdb
 Defines a simple memory pool used to call cub functions that use dynamic temporary storage.
namespace  nanovdb::cuda

Functions

template<class R>
R & default_resource ()
 Returns a program-lifetime, address-stable reference to a default instance of resource R.