tf::cudaUSMAllocator
taskflow/cuda/cuda_memory.hpp
tf::cudaUSMAllocator::rebind
typename T
T using tf::cudaUSMAllocator< T >::value_type = T value_type tf::cudaUSMAllocator::value_type

element type

T * using tf::cudaUSMAllocator< T >::pointer = T* pointer tf::cudaUSMAllocator::pointer

element pointer type

T & using tf::cudaUSMAllocator< T >::reference = T& reference tf::cudaUSMAllocator::reference

element reference type

const T * using tf::cudaUSMAllocator< T >::const_pointer = const T* const_pointer tf::cudaUSMAllocator::const_pointer

const element pointer type

const T & using tf::cudaUSMAllocator< T >::const_reference = const T& const_reference tf::cudaUSMAllocator::const_reference

constant element reference type

std::size_t using tf::cudaUSMAllocator< T >::size_type = std::size_t size_type tf::cudaUSMAllocator::size_type

size type

std::ptrdiff_t using tf::cudaUSMAllocator< T >::difference_type = std::ptrdiff_t difference_type tf::cudaUSMAllocator::difference_type

pointer difference type

tf::cudaUSMAllocator< T >::cudaUSMAllocator
() noexcept
cudaUSMAllocator
tf::cudaUSMAllocator::cudaUSMAllocator

Constructs a device allocator object.

tf::cudaUSMAllocator< T >::cudaUSMAllocator
(const cudaUSMAllocator &) noexcept
cudaUSMAllocator
tf::cudaUSMAllocator::cudaUSMAllocator
const cudaUSMAllocator &

Constructs a device allocator object from another device allocator object.

typename U
tf::cudaUSMAllocator< T >::cudaUSMAllocator
(const cudaUSMAllocator< U > &) noexcept
cudaUSMAllocator
tf::cudaUSMAllocator::cudaUSMAllocator
const cudaUSMAllocator< U > &

Constructs a device allocator object from another device allocator object with a different element type.

tf::cudaUSMAllocator< T >::~cudaUSMAllocator
() noexcept
~cudaUSMAllocator
tf::cudaUSMAllocator::~cudaUSMAllocator

Destructs the device allocator object.

pointer pointer tf::cudaUSMAllocator< T >::address (reference x) address tf::cudaUSMAllocator::address reference x

Returns the address of x.

This effectively means returning &x.

x

reference to an object

a pointer to the object

const_pointer const_pointer tf::cudaUSMAllocator< T >::address (const_reference x) const address tf::cudaUSMAllocator::address const_reference x

Returns the address of x.

This effectively means returning &x.

x

reference to an object

a pointer to the object

pointer pointer tf::cudaUSMAllocator< T >::allocate (size_type n, const void *=0) allocate tf::cudaUSMAllocator::allocate size_type n const void * 0

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.

n

number of elements (each of size sizeof(value_type)) to be allocated

a pointer to the initial element in the block of storage.

void void tf::cudaUSMAllocator< T >::deallocate (pointer ptr, size_type) deallocate tf::cudaUSMAllocator::deallocate pointer ptr size_type

Releases a block of storage previously allocated with member allocate and not yet released.

The elements in the array are not destroyed by a call to this member function.

ptr

pointer to a block of storage previously allocated with allocate

size_type size_type tf::cudaUSMAllocator< T >::max_size () const noexcept max_size tf::cudaUSMAllocator::max_size

returns the maximum number of elements that could potentially be allocated by this allocator

A call to member allocate with the value returned by this function can still fail to allocate the requested storage.

the number of elements that might be allocated as maximum by a call to member allocate

void void tf::cudaUSMAllocator< T >::construct (pointer ptr, const_reference val) construct tf::cudaUSMAllocator::construct pointer ptr const_reference val

Constructs an element object on the location pointed by ptr.

ptr

pointer to a location with enough storage soace to contain an element of type `value_type`

val

value to initialize the constructed element to

void void tf::cudaUSMAllocator< T >::destroy (pointer ptr) destroy tf::cudaUSMAllocator::destroy pointer ptr

destroys in-place the object pointed by `ptr`

Notice that this does not deallocate the storage for the element but calls its destructor.

ptr

pointer to the object to be destroye

typename U
bool bool tf::cudaUSMAllocator< T >::operator== (const cudaUSMAllocator< U > &) const noexcept operator== tf::cudaUSMAllocator::operator== const cudaUSMAllocator< U > &

compares two allocator of different types using `==`

USM allocators of different types are always equal to each other because the storage allocated by the allocator `a1` can be deallocated through `a2`.

typename U
bool bool tf::cudaUSMAllocator< T >::operator!= (const cudaUSMAllocator< U > &) const noexcept operator!= tf::cudaUSMAllocator::operator!= const cudaUSMAllocator< U > &

compares two allocator of different types using `!=`

USM allocators of different types are always equal to each other because the storage allocated by the allocator `a1` can be deallocated through `a2`.

class to create a unified shared memory (USM) allocator

T

element type

A cudaUSMAllocator enables using unified shared memory (USM) allocation for standard library containers. It is typically passed as template parameter when declaring standard library containers (e.g. std::vector).
- tf::cudaUSMAllocator
  address
- tf::cudaUSMAllocator
  address
- tf::cudaUSMAllocator
  allocate
- tf::cudaUSMAllocator
  const_pointer
- tf::cudaUSMAllocator
  const_reference
- tf::cudaUSMAllocator
  construct
- tf::cudaUSMAllocator
  cudaUSMAllocator
- tf::cudaUSMAllocator
  cudaUSMAllocator
- tf::cudaUSMAllocator
  cudaUSMAllocator
- tf::cudaUSMAllocator
  deallocate
- tf::cudaUSMAllocator
  destroy
- tf::cudaUSMAllocator
  difference_type
- tf::cudaUSMAllocator
  max_size
- tf::cudaUSMAllocator
  operator!=
- tf::cudaUSMAllocator
  operator==
- tf::cudaUSMAllocator
  pointer
- tf::cudaUSMAllocator
  reference
- tf::cudaUSMAllocator
  size_type
- tf::cudaUSMAllocator
  value_type
- tf::cudaUSMAllocator
  ~cudaUSMAllocator