|
| cudaDeviceAllocator () noexcept |
| Constructs a device allocator object.
|
|
| cudaDeviceAllocator (const cudaDeviceAllocator &) noexcept |
| Constructs a device allocator object from another device allocator object.
|
|
template<typename U > |
| cudaDeviceAllocator (const cudaDeviceAllocator< U > &) noexcept |
| Constructs a device allocator object from another device allocator object with a different element type.
|
|
| ~cudaDeviceAllocator () noexcept |
| Destructs the device allocator object.
|
|
pointer | address (reference x) |
| Returns the address of x.
|
|
const_pointer | address (const_reference x) const |
| Returns the address of x.
|
|
pointer | allocate (size_type n, std::allocator< void >::const_pointer=0) |
| allocates block of storage.
|
|
void | deallocate (pointer ptr, size_type) |
| Releases a block of storage previously allocated with member allocate and not yet released.
|
|
size_type | max_size () const noexcept |
| returns the maximum number of elements that could potentially be allocated by this allocator
|
|
void | construct (pointer, const_reference) |
| ignored to avoid de-referencing device pointer from the host
|
|
void | destroy (pointer) |
| ignored to avoid de-referencing device pointer from the host
|
|
template<typename U > |
bool | operator== (const cudaDeviceAllocator< U > &) const noexcept |
| compares two allocator of different types using ==
|
|
template<typename U > |
bool | operator!= (const cudaDeviceAllocator< U > &) const noexcept |
| compares two allocator of different types using !=
|
|
template<typename T>
class tf::cudaDeviceAllocator< T >
class to create a CUDA device allocator
- Template Parameters
-
A cudaDeviceAllocator enables device-specific allocation for standard library containers. It is typically passed as template parameter when declaring standard library containers (e.g. std::vector).
allocates block of storage.
Attempts to allocate a block of storage with a size large enough to contain n
elements of member type, value_type
, and returns a pointer to the first element.
The storage is aligned appropriately for object of type value_type
, but they are not constructed.
The block of storage is allocated using cudaMalloc and throws std::bad_alloc if it cannot allocate the total amount of storage requested.
- Parameters
-
n | number of elements (each of size sizeof(value_type)) to be allocated |
- Returns
- a pointer to the initial element in the block of storage.