Loading...
Searching...
No Matches
rmm::cuda_stream Class Reference

Owning wrapper for a CUDA stream. More...

#include <cuda_stream.hpp>

Public Types

enum class  flags : unsigned int { sync_default = cudaStreamDefault , non_blocking }
 stream creation flags. More...

Public Member Functions

 cuda_stream (cuda_stream &&)=default
 Move constructor (default).
cuda_stream & operator= (cuda_stream &&)=default
 Move copy assignment operator (default).
 cuda_stream (cuda_stream const &)=delete
cuda_stream & operator= (cuda_stream &)=delete
 cuda_stream (cuda_stream::flags flagsflags=cuda_stream::flags::sync_default)
 Construct a new CUDA stream object.
bool is_valid () const
 Returns true if the owned stream is non-null.
cudaStream_t value () const
 Get the value of the wrapped CUDA stream.
 operator cudaStream_t () const noexcept
 Explicit conversion to cudaStream_t.
 operator cuda::stream_ref () const noexcept
 Implicit conversion to cuda::stream_ref.
void synchronize () const
 Synchronize the owned CUDA stream.
void synchronize_no_throw () const noexcept
 Synchronize the owned CUDA stream. Does not throw if there is an error.

Detailed Description

Owning wrapper for a CUDA stream.

Provides RAII lifetime semantics for a CUDA stream.

Member Enumeration Documentation

◆ flags

enum class rmm::cuda_stream::flags : unsigned int
strong

stream creation flags.

Enumerator
sync_default 

Created stream synchronizes with the default stream.

non_blocking 

Created stream does not synchronize with the default stream.

Constructor & Destructor Documentation

◆ cuda_stream() [1/2]

rmm::cuda_stream::cuda_stream ( cuda_stream && )
default

Move constructor (default).

A moved-from cuda_stream is invalid and it is Undefined Behavior to call methods that access the owned stream.

◆ cuda_stream() [2/2]

rmm::cuda_stream::cuda_stream ( cuda_stream::flags flags = cuda_stream::flags::sync_default)

Construct a new CUDA stream object.

Parameters
flagsStream creation flags.
Exceptions
rmm::cuda_errorif stream creation fails

Member Function Documentation

◆ is_valid()

bool rmm::cuda_stream::is_valid ( ) const
nodiscard

Returns true if the owned stream is non-null.

Returns
true If the owned stream has not been explicitly moved and is therefore non-null.
false If the owned stream has been explicitly moved and is therefore null.

◆ operator cuda::stream_ref()

rmm::cuda_stream::operator cuda::stream_ref ( ) const
noexcept

Implicit conversion to cuda::stream_ref.

Returns
A stream_ref for the owned stream

◆ operator=()

cuda_stream & rmm::cuda_stream::operator= ( cuda_stream && )
default

Move copy assignment operator (default).

A moved-from cuda_stream is invalid and it is Undefined Behavior to call methods that access the owned stream.

Returns
A reference to this cuda_stream

◆ synchronize()

void rmm::cuda_stream::synchronize ( ) const

Synchronize the owned CUDA stream.

Calls cudaStreamSynchronize().

Exceptions
rmm::cuda_errorif stream synchronization fails

◆ synchronize_no_throw()

void rmm::cuda_stream::synchronize_no_throw ( ) const
noexcept

Synchronize the owned CUDA stream. Does not throw if there is an error.

Calls cudaStreamSynchronize() and asserts if there is an error.

◆ value()

cudaStream_t rmm::cuda_stream::value ( ) const
nodiscard

Get the value of the wrapped CUDA stream.

Returns
cudaStream_t The wrapped CUDA stream.

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