8 #include <rmm/detail/export.hpp>
10 #include <cuda/stream>
11 #include <cuda_runtime_api.h>
65 [[nodiscard]] cudaStream_t
value() const noexcept;
72 [[nodiscard]] cudaStream_t get() const noexcept;
79 operator cudaStream_t() const noexcept;
86 operator cuda::stream_ref() const noexcept;
91 [[nodiscard]]
bool is_per_thread_default() const noexcept;
96 [[nodiscard]]
bool is_default() const noexcept;
105 void synchronize() const;
121 void synchronize_no_throw() const noexcept;
124 cudaStream_t stream_{};
132 [[deprecated(
"Use cuda::stream_ref{cudaStream_t{cudaStreamDefault}} instead.")]]
140 [[deprecated(
"Use cuda::stream_ref{cudaStreamLegacy} instead.")]]
148 [[deprecated(
"Use cuda::stream_ref{cudaStreamPerThread} instead.")]]
151 #if defined(__GNUC__) || defined(__clang__)
152 #pragma GCC diagnostic push
153 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
166 template <std::same_as<cuda::stream_ref> StreamRef>
169 return lhs.
value() == rhs.get();
173 template <std::same_as<cuda::stream_ref> StreamRef>
176 return lhs.get() == rhs.
value();
189 template <std::same_as<cuda::stream_ref> StreamRef>
192 return lhs.
value() != rhs.get();
196 template <std::same_as<cuda::stream_ref> StreamRef>
199 return lhs.get() != rhs.
value();
211 #if defined(__GNUC__) || defined(__clang__)
212 #pragma GCC diagnostic pop
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:31
cuda_stream_view(cuda_stream_view &&)=default
Default move constructor.
cuda_stream_view & operator=(cuda_stream_view &&)=default
Default move assignment operator.
cuda_stream_view & operator=(cuda_stream_view const &)=default
Default copy assignment operator.
cuda_stream_view(cuda_stream_view const &)=default
Default copy constructor.
cuda_stream_view(cudaStream_t stream) noexcept
Constructor from a cudaStream_t.
cudaStream_t value() const noexcept
Get the wrapped stream.
cuda_stream_view(cuda::stream_ref stream) noexcept
Implicit conversion from stream_ref.
static const cuda::stream_ref cuda_stream_legacy
Static cuda::stream_ref of cudaStreamLegacy, for convenience.
Definition: cuda_stream_view.hpp:141
static const cuda::stream_ref cuda_stream_per_thread
Static cuda::stream_ref of cudaStreamPerThread, for convenience.
Definition: cuda_stream_view.hpp:149
bool operator!=(StreamRef const &lhs, cuda_stream_view rhs)
Inequality comparison operator for streams.
Definition: cuda_stream_view.hpp:197
std::ostream & operator<<(std::ostream &os, cuda_stream_view stream)
Output stream operator for printing / logging streams.
static constexpr cuda::stream_ref cuda_stream_default
Static cuda::stream_ref of the default stream (stream 0), for convenience.
Definition: cuda_stream_view.hpp:133
bool operator==(StreamRef const &lhs, cuda_stream_view rhs)
Equality comparison operator for streams.
Definition: cuda_stream_view.hpp:174