Class thrust::device_new_allocator
device_new_allocator
is a device memory allocator that employs the device_new
function for allocation.
See:
#include <thrust/device_new_allocator.h>
template <typename T> class thrust::device_new_allocator { public: typedef see below value_type;
typedef see below pointer;
typedef see below const_pointer;
typedef see below reference;
typedef see below const_reference;
typedef see below size_type;
typedef see below difference_type;
template <typename U> struct rebind;
_CCCL_HOST_DEVICE device_new_allocator();
_CCCL_HOST_DEVICE ~device_new_allocator();
_CCCL_HOST_DEVICE device_new_allocator(device_new_allocator const &);
template <typename U> _CCCL_HOST_DEVICE device_new_allocator(device_new_allocator< U > const &);
_CCCL_HOST_DEVICE pointer address(reference r);
_CCCL_HOST_DEVICE const_pointer address(const_reference r);
_CCCL_HOST pointer allocate(size_type cnt, const_pointer = const_pointer(static_cast< T * >(0)));
_CCCL_HOST void deallocate(pointer p, size_type cnt);
_CCCL_HOST_DEVICE size_type max_size() const;
_CCCL_HOST_DEVICE bool operator==(device_new_allocator const &);
_CCCL_HOST_DEVICE bool operator!=(device_new_allocator const & a); };
Member Classes
Struct thrust::device_new_allocator::rebind
Member Types
Typedef thrust::device_new_allocator::value_type
typedef Tvalue_type;
Type of element allocated, T
.
Typedef thrust::device_new_allocator::pointer
typedef device_ptr< T >pointer;
Pointer to allocation, device_ptr<T>
.
Typedef thrust::device_new_allocator::const_pointer
typedef device_ptr< const T >const_pointer;
const
pointer to allocation, device_ptr<const T>
.
Typedef thrust::device_new_allocator::reference
typedef device_reference< T >reference;
Reference to allocated element, device_reference<T>
.
Typedef thrust::device_new_allocator::const_reference
typedef device_reference< const T >const_reference;
const
reference to allocated element, device_reference<const T>
.
Typedef thrust::device_new_allocator::size_type
typedef ::cuda::std::size_tsize_type;
Type of allocation size, ::cuda::std::size_t
.
Typedef thrust::device_new_allocator::difference_type
typedef pointer::difference_typedifference_type;
Type of allocation difference, pointer::difference_type
.
Member Functions
Function thrust::device_new_allocator::device_new_allocator
_CCCL_HOST_DEVICE device_new_allocator();
No-argument constructor has no effect.
Function thrust::device_new_allocator::~device_new_allocator
_CCCL_HOST_DEVICE ~device_new_allocator();
No-argument destructor has no effect.
Function thrust::device_new_allocator::device_new_allocator
_CCCL_HOST_DEVICE device_new_allocator(device_new_allocator const &);
Copy constructor has no effect.
Function thrust::device_new_allocator::device_new_allocator
template <typename U> _CCCL_HOST_DEVICE device_new_allocator(device_new_allocator< U > const &);
Constructor from other device_malloc_allocator
has no effect.
Function thrust::device_new_allocator::address
_CCCL_HOST_DEVICE pointer address(reference r);
Returns the address of an allocated object.
Returns: &r
.
Function thrust::device_new_allocator::address
_CCCL_HOST_DEVICE const_pointer address(const_reference r);
Returns the address an allocated object.
Returns: &r
.
Function thrust::device_new_allocator::allocate
_CCCL_HOST pointer allocate(size_type cnt, const_pointer = const_pointer(static_cast< T * >(0)));
Allocates storage for cnt
objects.
Note: Memory allocated by this function must be deallocated with deallocate
.
Function Parameters: cnt
: The number of objects to allocate.
Returns: A pointer
to uninitialized storage for cnt
objects.
Function thrust::device_new_allocator::deallocate
_CCCL_HOST void deallocate(pointer p, size_type cnt);
Deallocates storage for objects allocated with allocate
.
Note: Memory deallocated by this function must previously have been allocated with allocate
.
Function Parameters:
p
Apointer
to the storage to deallocate.cnt
The size of the previous allocation.
Function thrust::device_new_allocator::max_size
_CCCL_HOST_DEVICE size_type max_size() const;
Returns the largest value n
for which allocate(n)
might succeed.
Returns: The largest value n
for which allocate(n)
might succeed.
Function thrust::device_new_allocator::operator==
_CCCL_HOST_DEVICE bool operator==(device_new_allocator const &);
Compares against another device_malloc_allocator
for equality.
Returns: true
Function thrust::device_new_allocator::operator!=
_CCCL_HOST_DEVICE bool operator!=(device_new_allocator const & a);
Compares against another device_malloc_allocator
for inequality.
Returns: false