Public Types | Public Member Functions | List of all members
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) More...
 
cuda_streamoperator= (cuda_stream &&)=default
 Move copy assignment operator (default) More...
 
 cuda_stream (cuda_stream const &)=delete
 
cuda_streamoperator= (cuda_stream &)=delete
 
 cuda_stream (cuda_stream::flags flags=cuda_stream::flags::sync_default)
 Construct a new cuda stream object. More...
 
bool is_valid () const
 Returns true if the owned stream is non-null. More...
 
cudaStream_t value () const
 Get the value of the wrapped CUDA stream. More...
 
 operator cudaStream_t () const noexcept
 Explicit conversion to cudaStream_t.
 
cuda_stream_view view () const
 Creates an immutable, non-owning view of the wrapped CUDA stream. More...
 
 operator cuda_stream_view () const
 Implicit conversion to cuda_stream_view. More...
 
void synchronize () const
 Synchronize the owned CUDA stream. More...
 
void synchronize_no_throw () const noexcept
 Synchronize the owned CUDA stream. Does not throw if there is an error. More...
 

Detailed Description

Owning wrapper for a CUDA stream.

Provides RAII lifetime semantics for a CUDA stream.

Member Enumeration Documentation

◆ flags

enum 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

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_view()

rmm::cuda_stream::operator cuda_stream_view ( ) const

Implicit conversion to cuda_stream_view.

Returns
A view of 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

Get the value of the wrapped CUDA stream.

Returns
cudaStream_t The wrapped CUDA stream.

◆ view()

cuda_stream_view rmm::cuda_stream::view ( ) const

Creates an immutable, non-owning view of the wrapped CUDA stream.

Returns
rmm::cuda_stream_view The view of the CUDA stream

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