cuda::experimental::stf::stream_adapter

Defined in include/cuda/experimental/__stf/allocators/adapters.cuh

class stream_adapter

Allocator which defers allocations to the CUDA asynchronous memory allocations APIs (cudaMallocAsync, cudaFreeAsync)

This can be used as an alternative in CUDA graphs to avoid creating CUDA graphs with a large memory footprints. Allocations will be done in the same stream as the one used to launch the graph, and will be destroyed in that stream when the graph has been launched.

Public Functions

template<typename context_t>
inline stream_adapter(context_t &ctx, cudaStream_t stream)
stream_adapter(const stream_adapter&) = delete
stream_adapter &operator=(const stream_adapter&) = delete
inline stream_adapter(stream_adapter &&other) noexcept
inline stream_adapter &operator=(stream_adapter &&other) noexcept
inline ~stream_adapter()
inline void clear()

Free resources allocated by the stream_adapter object.

inline auto &allocator()

Get the underlying block allocator so that we can set the allocator of a context, or a logical data.