19 #include <rmm/cuda_stream.hpp>
20 #include <rmm/cuda_stream_view.hpp>
21 #include <rmm/detail/error.hpp>
49 RMM_EXPECTS(pool_size > 0,
"Stream pool size must be greater than zero");
67 return streams_[(next_stream++) % streams_.size()].view();
82 return streams_[stream_id % streams_.size()].view();
95 std::vector<rmm::cuda_stream> streams_;
96 mutable std::atomic_size_t next_stream{};
A pool of CUDA streams.
Definition: cuda_stream_pool.hpp:37
cuda_stream_pool(std::size_t pool_size=default_size)
Construct a new cuda stream pool object of the given non-zero size.
Definition: cuda_stream_pool.hpp:47
rmm::cuda_stream_view get_stream() const noexcept
Get a cuda_stream_view of a stream in the pool.
Definition: cuda_stream_pool.hpp:65
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:34
rmm::cuda_stream_view get_stream(std::size_t stream_id) const
Get a cuda_stream_view of the stream associated with stream_id. Equivalent values of stream_id return...
Definition: cuda_stream_pool.hpp:80
static constexpr std::size_t default_size
Default stream pool size.
Definition: cuda_stream_pool.hpp:39
std::size_t get_pool_size() const noexcept
Get the number of streams in the pool.
Definition: cuda_stream_pool.hpp:92