cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
Typedefs | Enumerations | Functions | Variables
cuda::stream Namespace Reference

Definitions and functionality related to CUDA streams (not including the device wrapper type stream_t itself) More...

Typedefs

using handle_t = cudaStream_t
 The CUDA Runtime API's handle for streams.
 
using priority_t = int
 CUDA streams have a scheduling priority, with lower values meaning higher priority. More...
 

Enumerations

enum  : bool {
  implicitly_synchronizes_with_default_stream = true,
  no_implicit_synchronization_with_default_stream = false,
  sync = implicitly_synchronizes_with_default_stream,
  async = no_implicit_synchronization_with_default_stream,
  blocking = sync,
  nonblocking = async
}
 
enum  : priority_t { default_priority = 0 }
 

Functions

stream_t create (device_t device, bool synchronizes_with_default_stream, priority_t priority=stream::default_priority)
 Create a new stream (= queue) on a CUDA device. More...
 

Variables

const stream::handle_t default_stream_handle = nullptr
 The CUDA runtime provides a default stream on which work is scheduled when no stream is specified; for those API calls where you need to specify the relevant stream's ID, and want to specify the default, this is what you use.
 

Detailed Description

Definitions and functionality related to CUDA streams (not including the device wrapper type stream_t itself)

Typedef Documentation

◆ priority_t

using cuda::stream::priority_t = typedef int

CUDA streams have a scheduling priority, with lower values meaning higher priority.

The types represents a larger range of values than those actually used; they can be obtained by device_t::stream_priority_range() .

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : priority_t
Enumerator
default_priority 

the scheduling priority of a stream created without specifying any other priority value

Function Documentation

◆ create()

stream_t cuda::stream::create ( device_t  device,
bool  synchronizes_with_default_stream,
priority_t  priority = stream::default_priority 
)
inline

Create a new stream (= queue) on a CUDA device.

Parameters
devicethe device on which a stream is to be created
synchronizes_with_default_streamif true, no work on this stream will execute concurrently with work from the default stream (stream 0)
prioritypriority of tasks on the stream, relative to other streams, for execution scheduling; lower numbers represent higher properties. Each device has a range of priorities, which can be obtained using device_t::stream_priority_range() .
Returns
The newly-created stream