cuda::experimental::stf::uncached_stream_allocator

Defined in include/cuda/experimental/__stf/stream/stream_ctx.cuh

class uncached_stream_allocator : public cuda::experimental::stf::block_allocator_interface

Uncached allocator (used as a basis for other allocators)

Any allocation/deallocation results in an actual underlying CUDA API call (e.g. cudaMallocAsync). This allocator should generally not be used directly, but used within an allocator with a more advanced strategy (caching, heap allocation, …)

Public Functions

uncached_stream_allocator() = default
inline virtual void *allocate(backend_ctx_untyped &ctx, const data_place &memory_node, ::std::ptrdiff_t &s, event_list &prereqs) override

Asynchronous allocation of memory.

This method asynchronously allocates *s bytes on the specified memory node. Upon success, *ptr will contain the address of the allocated buffer. If the allocation fails, *s will contain a negative value.

Parameters
  • ctx – Untyped backend context

  • memory_node – Memory node where the allocation should occur

  • s – Pointer to the size of the allocation

  • prereqs – List of events that should finish before the allocation starts

Returns

void* Pointer to the allocated memory

inline virtual void deallocate(backend_ctx_untyped &ctx, const data_place &memory_node, event_list &prereqs, void *ptr, size_t) override

Deallocation of memory.

This method deallocates memory previously allocated by the allocate method.

Parameters
  • ctx – Untyped backend context

  • memory_node – Memory node where the deallocation should occur

  • prereqs – List of events that should finish before the deallocation starts

  • ptr – Pointer to the memory to be deallocated

  • sz – Size of the memory to be deallocated

inline virtual event_list deinit(backend_ctx_untyped&) override

Deinitialization of the allocator.

Returns

List of events indicating that this was deinitialized

inline virtual ::std::string to_string() const override

String representation of the allocator.

This method returns a string representation of the allocator.

Returns

std::string String representation of the allocator

inline virtual void print_info() const

Print information about the allocator.

This method prints information about the allocator to stderr.