Fermat
Public Types | Public Methods | List of all members
cugar::caching_device_allocator< T > Struct Template Reference

Detailed description

template<typename T>
struct cugar::caching_device_allocator< T >

Implements a caching device allocator based on CUB's

#include <allocator.h>

Public Types

typedef T value_type
 
typedef thrust::device_ptr< T > pointer
 
typedef thrust::device_ptr< const T > const_pointer
 
typedef thrust::device_reference< T > reference
 
typedef thrust::device_reference< const T > const_reference
 
typedef std::size_t size_type
 
typedef pointer::difference_type difference_type
 

Public Methods

__host__ __device__ pointer address (reference r)
 
__host__ __device__ const_pointer address (const_reference r)
 
CUGAR_HOST pointer allocate (size_type cnt, const_pointer=const_pointer(static_cast< T *>(0)))
 
CUGAR_HOST void deallocate (pointer p, size_type cnt)
 

Member Typedef Documentation

◆ const_pointer

template<typename T >
typedef thrust::device_ptr<const T> cugar::caching_device_allocator< T >::const_pointer

const pointer to allocation, device_ptr<const T>.

◆ const_reference

template<typename T >
typedef thrust::device_reference<const T> cugar::caching_device_allocator< T >::const_reference

const reference to allocated element, device_reference<const T>.

◆ difference_type

template<typename T >
typedef pointer::difference_type cugar::caching_device_allocator< T >::difference_type

Type of allocation difference, pointer::difference_type.

◆ pointer

template<typename T >
typedef thrust::device_ptr<T> cugar::caching_device_allocator< T >::pointer

Pointer to allocation, device_ptr<T>.

◆ reference

template<typename T >
typedef thrust::device_reference<T> cugar::caching_device_allocator< T >::reference

Reference to allocated element, device_reference<T>.

◆ size_type

template<typename T >
typedef std::size_t cugar::caching_device_allocator< T >::size_type

Type of allocation size, std::size_t.

◆ value_type

template<typename T >
typedef T cugar::caching_device_allocator< T >::value_type

Type of element allocated, T.

Member Function Documentation

◆ address() [1/2]

template<typename T >
__host__ __device__ pointer cugar::caching_device_allocator< T >::address ( reference  r)
inline

Returns the address of an allocated object.

Returns
&r.

◆ address() [2/2]

template<typename T >
__host__ __device__ const_pointer cugar::caching_device_allocator< T >::address ( const_reference  r)
inline

Returns the address an allocated object.

Returns
&r.

◆ allocate()

template<typename T >
CUGAR_HOST pointer cugar::caching_device_allocator< T >::allocate ( size_type  cnt,
const_pointer  = const_pointer(static_cast<T*>(0)) 
)
inline

Allocates storage for cnt objects.

Parameters
cntThe number of objects to allocate.
Returns
A pointer to uninitialized storage for cnt objects.
Note
Memory allocated by this function must be deallocated with deallocate.

◆ deallocate()

template<typename T >
CUGAR_HOST void cugar::caching_device_allocator< T >::deallocate ( pointer  p,
size_type  cnt 
)
inline

Deallocates storage for objects allocated with allocate.

Parameters
pA pointer to the storage to deallocate.
cntThe size of the previous allocation.
Note
Memory deallocated by this function must previously have been allocated with allocate.

The documentation for this struct was generated from the following file: