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.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/detail/export.hpp>
9
10
#include <cuda/stream>
11
#include <cuda_runtime_api.h>
12
13
#include <functional>
14
#include <memory>
15
16
RMM_NAMESPACE_BEGIN
22
28
class
cuda_stream
{
29
public
:
33
enum class
flags
:
unsigned
int
{
34
sync_default = cudaStreamDefault,
35
non_blocking =
36
cudaStreamNonBlocking,
37
};
38
44
cuda_stream
(
cuda_stream
&&) =
default
;
53
cuda_stream
&
operator=
(
cuda_stream
&&) =
default
;
54
~cuda_stream
() =
default
;
55
cuda_stream
(
cuda_stream
const
&) =
delete
;
// Copying disallowed: one stream one owner
56
cuda_stream
&
operator=
(
cuda_stream
&) =
delete
;
57
65
cuda_stream
(
cuda_stream::flags
flags
=
cuda_stream::flags::sync_default
);
66
73
[[nodiscard]]
bool
is_valid
()
const
;
74
80
[[nodiscard]] cudaStream_t
value
()
const
;
81
85
explicit
operator
cudaStream_t() const noexcept;
86
92
operator cuda::
stream_ref
() const noexcept;
93
101
void
synchronize
() const;
102
108
void
synchronize_no_throw
() const noexcept;
109
110
private:
111
std::unique_ptr<cudaStream_t, std::function<
void
(cudaStream_t*)>> stream_;
112
};
113
// end of group
115
RMM_NAMESPACE_END
rmm::cuda_stream::stream_ref
operator cuda::stream_ref() const noexcept
Implicit conversion to cuda::stream_ref.
rmm::cuda_stream::synchronize_no_throw
void synchronize_no_throw() const noexcept
Synchronize the owned CUDA stream. Does not throw if there is an error.
rmm::cuda_stream::is_valid
bool is_valid() const
Returns true if the owned stream is non-null.
rmm::cuda_stream::synchronize
void synchronize() const
Synchronize the owned CUDA stream.
rmm::cuda_stream::operator=
cuda_stream & operator=(cuda_stream &&)=default
Move copy assignment operator (default).
rmm::cuda_stream::value
cudaStream_t value() const
Get the value of the wrapped CUDA stream.
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
rmm::cuda_stream::cuda_stream
cuda_stream(cuda_stream &&)=default
Move constructor (default).
rmm::cuda_stream::cuda_stream
cuda_stream(cuda_stream::flags flags=cuda_stream::flags::sync_default)
Construct a new CUDA stream object.
Generated by
1.18.0