10#ifndef NANOVDB_CUDA_TEMPPOOL_H_HAS_BEEN_INCLUDED
11#define NANOVDB_CUDA_TEMPPOOL_H_HAS_BEEN_INCLUDED
17#include <cuda_runtime_api.h>
23template <
class Resource>
26 "TempPool allocates stream-ordered scratch and requires an AsyncResource");
41 : mResource(&resource)
47 void*
data() {
return mBuffer.data();}
52 size_t&
size() {
return mSize;}
60 cudaStream_t
stream()
const {
return mBuffer.stream();}
68 if (mBuffer.empty() || mRequestedSize > mSize) {
71 mSize = mBuffer.size();
73 mBuffer.set_stream(
stream);
80 size_t mRequestedSize{0};
Typed containers for CUDA memory: the owning, resource-aware, stream-ordered cuda::Buffer and the non...
Owning, typed container of T elements allocated from a memory resource R held by value.
Definition Buffer.h:69
void * data()
Returns a non-const void pointer to the data managed by this instance.
Definition TempPool.h:47
TempPool(Resource &resource)
C-tor of an empty memory pool that routes all allocations through the supplied Resource instance.
Definition TempPool.h:40
size_t & size()
Returns a non-const reference to the actual size of the data managed by this instance.
Definition TempPool.h:52
TempPool()
Default c-tor of an empty memory pool that uses the default instance of Resource for all allocations.
Definition TempPool.h:35
void reallocate(cudaStream_t stream)
Re-allocation of the data managed by this instance. Only has affect if the pool in empty or the reque...
Definition TempPool.h:67
size_t & requestedSize()
Returns a non-const reference to the requested size of the data managed by this instance.
Definition TempPool.h:56
cudaStream_t stream() const
Returns the stream that the managed memory was last (re)allocated on, i.e. the stream this pool will ...
Definition TempPool.h:60
Definition GridHandle.h:37
R & default_resource()
Returns a program-lifetime, address-stable reference to a default instance of resource R.
Definition DeviceResource.h:87
constexpr NoInit noInit
Definition Buffer.h:29
TempPool< DeviceResource > TempDevicePool
Definition TempPool.h:83
Defines a simple memory pool used to call cub functions that use dynamic temporary storage.
Definition GridHandle.h:31
Non-owning reference to a memory resource that is itself a resource: copying the ref shares the under...
Definition DeviceResource.h:312
Detection trait: is_async_resource<R>::value is true iff R models the stream-ordered AsyncResource co...
Definition DeviceResource.h:118