OpenVDB 13.1.0
Loading...
Searching...
No Matches
TempPool< Resource > Class Template Reference

#include <nanovdb/cuda/TempPool.h>

Public Member Functions

 TempPool ()
 Default c-tor of an empty memory pool that uses the default instance of Resource for all allocations.
 TempPool (Resource &resource)
 C-tor of an empty memory pool that routes all allocations through the supplied Resource instance.
void * data ()
 Returns a non-const void pointer to the data managed by this instance.
size_t & size ()
 Returns a non-const reference to the actual size of the data managed by this instance.
size_t & requestedSize ()
 Returns a non-const reference to the requested size of the data managed by this instance.
cudaStream_t stream () const
 Returns the stream that the managed memory was last (re)allocated on, i.e. the stream this pool will free on at destruction.
void reallocate (cudaStream_t stream)
 Re-allocation of the data managed by this instance. Only has affect if the pool in empty or the requested memory is larger than the existing size.

Constructor & Destructor Documentation

◆ TempPool() [1/2]

template<class Resource>
TempPool ( )
inline

Default c-tor of an empty memory pool that uses the default instance of Resource for all allocations.

◆ TempPool() [2/2]

template<class Resource>
TempPool ( Resource & resource)
inlineexplicit

C-tor of an empty memory pool that routes all allocations through the supplied Resource instance.

Parameters
resourceresource instance to allocate from; must outlive this pool.

Member Function Documentation

◆ data()

template<class Resource>
void * data ( )
inline

Returns a non-const void pointer to the data managed by this instance.

◆ reallocate()

template<class Resource>
void reallocate ( cudaStream_t stream)
inline

Re-allocation of the data managed by this instance. Only has affect if the pool in empty or the requested memory is larger than the existing size.

Parameters
streamcuda stream used for asynchronous de-allocation and allocation.
Note
Scratch is discarded, never resized: preserving a prefix of temporary storage would be a wasted copy.

◆ requestedSize()

template<class Resource>
size_t & requestedSize ( )
inline

Returns a non-const reference to the requested size of the data managed by this instance.

Note
This requested size should always be less than or smaller than the actual size().

◆ size()

template<class Resource>
size_t & size ( )
inline

Returns a non-const reference to the actual size of the data managed by this instance.

Note
Returned by reference because cub's two-pass API takes the storage size as a size_t&, so this cannot forward Buffer::size() by value.

◆ stream()

template<class Resource>
cudaStream_t stream ( ) const
inline

Returns the stream that the managed memory was last (re)allocated on, i.e. the stream this pool will free on at destruction.