Template Numerical Library version\ main:bb09b17
Loading...
Searching...
No Matches
TNL::Backend::Stream Class Reference

Public Member Functions

 Stream ()=default
 Constructs a stream wrapping the CUDA 0 (NULL) stream.
 
 Stream (const Stream &other)=default
 Default copy-constructor.
 
 Stream (Stream &&other) noexcept=default
 Default move-constructor.
 
 operator const stream_t & () const
 Access the CUDA stream handle associated with this object.
 
Streamoperator= (const Stream &other)=default
 Default copy-assignment operator.
 
Streamoperator= (Stream &&other) noexcept=default
 Default move-assignment operator.
 

Static Public Member Functions

static Stream create (unsigned int flags=StreamDefault, int priority=0)
 Creates a new stream.
 

Member Function Documentation

◆ create()

static Stream TNL::Backend::Stream::create ( unsigned int flags = StreamDefault,
int priority = 0 )
inlinestatic

Creates a new stream.

The stream is created by calling cudaStreamCreateWithPriority with the following parameters:

Parameters
flagsCustom flags for stream creation. Possible values are:
  • cudaStreamDefault: Default stream creation flag.
  • cudaStreamNonBlocking: Specifies that work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and that the created stream should perform no implicit synchronization with stream 0.
priorityPriority of the stream. Lower numbers represent higher priorities. See cudaDeviceGetStreamPriorityRange for more information about the meaningful stream priorities that can be passed.

◆ operator const stream_t &()

TNL::Backend::Stream::operator const stream_t & ( ) const
inline

Access the CUDA stream handle associated with this object.

This routine permits the implicit conversion from Stream to stream_t.

Warning
The obtained stream_t handle becomes invalid when the originating Stream object is destroyed. For example, the following code is invalid, because the Stream object managing the lifetime of the stream_t handle is destroyed as soon as it is cast to stream_t:
const TNL::Backend::stream_t stream = TNL::Backend::Stream::create();
my_kernel<<< gridSize, blockSize, 0, stream >>>( args... );
static Stream create(unsigned int flags=StreamDefault, int priority=0)
Creates a new stream.
Definition Stream.h:75

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