Public Member Functions | Static Public Attributes | List of all members
rmm::cuda_stream_pool Class Reference

A pool of CUDA streams. More...

#include <cuda_stream_pool.hpp>

Public Member Functions

 cuda_stream_pool (std::size_t pool_size=default_size, cuda_stream::flags flags=cuda_stream::flags::sync_default)
 Construct a new CUDA stream pool object of the given non-zero size. More...
 
 cuda_stream_pool (cuda_stream_pool &&)=delete
 
 cuda_stream_pool (cuda_stream_pool const &)=delete
 
cuda_stream_pooloperator= (cuda_stream_pool &&)=delete
 
cuda_stream_pooloperator= (cuda_stream_pool const &)=delete
 
cuda::stream_ref get_stream () const noexcept
 Get a cuda::stream_ref of a stream in the pool. More...
 
cuda::stream_ref get_stream (std::size_t stream_id) const
 Get a cuda::stream_ref of the stream associated with stream_id. Equivalent values of stream_id return a stream_ref to the same underlying stream. More...
 
std::size_t get_pool_size () const noexcept
 Get the number of streams in the pool. More...
 

Static Public Attributes

static constexpr std::size_t default_size {16}
 Default stream pool size.
 

Detailed Description

A pool of CUDA streams.

Provides efficient access to collection of CUDA stream objects.

Successive calls may return a cuda::stream_ref of identical streams. For example, a possible implementation is to maintain a circular buffer of cuda_stream objects.

Constructor & Destructor Documentation

◆ cuda_stream_pool()

rmm::cuda_stream_pool::cuda_stream_pool ( std::size_t  pool_size = default_size,
cuda_stream::flags  flags = cuda_stream::flags::sync_default 
)
explicit

Construct a new CUDA stream pool object of the given non-zero size.

Exceptions
logic_errorif pool_size is zero
Parameters
pool_sizeThe number of streams in the pool
flagsFlags used when creating streams in the pool.

Member Function Documentation

◆ get_pool_size()

std::size_t rmm::cuda_stream_pool::get_pool_size ( ) const
noexcept

Get the number of streams in the pool.

This function is thread safe with respect to other calls to the same function.

Returns
the number of streams in the pool

◆ get_stream() [1/2]

cuda::stream_ref rmm::cuda_stream_pool::get_stream ( ) const
noexcept

Get a cuda::stream_ref of a stream in the pool.

This function is thread safe with respect to other calls to the same function.

Returns
cuda::stream_ref

◆ get_stream() [2/2]

cuda::stream_ref rmm::cuda_stream_pool::get_stream ( std::size_t  stream_id) const

Get a cuda::stream_ref of the stream associated with stream_id. Equivalent values of stream_id return a stream_ref to the same underlying stream.

This function is thread safe with respect to other calls to the same function.

Parameters
stream_idUnique identifier for the desired stream
Returns
cuda::stream_ref
Note
stream_id is wrapped around the pool size, therefore any size_t value is allowed.

The documentation for this class was generated from the following file: