Home
librmm
libucxx
ucxx
nightly (26.12)
nightly (26.12)
stable (26.10)
legacy (26.08)
Toggle main menu visibility
Loading...
Searching...
No Matches
include
rmm
cuda_stream_pool.hpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
* SPDX-License-Identifier: Apache-2.0
4
*/
5
6
#pragma once
7
8
#include <
rmm/cuda_stream.hpp
>
9
#include <rmm/detail/export.hpp>
10
11
#include <cuda/stream>
12
13
#include <atomic>
14
#include <cstddef>
15
#include <vector>
16
17
RMM_NAMESPACE_BEGIN
23
32
class
cuda_stream_pool
{
33
public
:
34
static
constexpr
std::size_t
default_size
{16};
35
43
explicit
cuda_stream_pool
(std::size_t pool_size =
default_size
,
44
cuda_stream::flags
flags =
cuda_stream::flags::sync_default
);
45
~cuda_stream_pool
() =
default
;
46
47
cuda_stream_pool
(
cuda_stream_pool
&&) =
delete
;
48
cuda_stream_pool
(
cuda_stream_pool
const
&) =
delete
;
49
cuda_stream_pool
& operator=(
cuda_stream_pool
&&) =
delete
;
50
cuda_stream_pool
& operator=(
cuda_stream_pool
const
&) =
delete
;
51
59
cuda::stream_ref
get_stream
() const noexcept;
60
74
cuda::stream_ref
get_stream
(std::
size_t
stream_id) const;
75
83
std::
size_t
get_pool_size
() const noexcept;
84
85
private:
86
std::vector<
rmm
::
cuda_stream
> streams_;
87
mutable std::atomic_size_t next_stream{};
88
};
89
// end of group
91
RMM_NAMESPACE_END
rmm::cuda_stream_pool::default_size
static constexpr std::size_t default_size
Default stream pool size.
Definition
cuda_stream_pool.hpp:34
rmm::cuda_stream_pool::get_pool_size
std::size_t get_pool_size() const noexcept
Get the number of streams in the pool.
rmm::cuda_stream_pool::cuda_stream_pool
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.
rmm::cuda_stream_pool::get_stream
cuda::stream_ref get_stream() const noexcept
Get a cuda::stream_ref of a stream in the pool.
rmm::cuda_stream
Owning wrapper for a CUDA stream.
Definition
cuda_stream.hpp:28
rmm::cuda_stream::flags
flags
stream creation flags.
Definition
cuda_stream.hpp:33
rmm::cuda_stream::flags::sync_default
@ sync_default
Created stream synchronizes with the default stream.
Definition
cuda_stream.hpp:34
cuda_stream.hpp
rmm
The top-level namespace containing all RMM functionality.
Generated by
1.18.0