Thin C++-flavored wrappers for the CUDA Runtime API
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
cuda::stream_t Class Reference

Proxy class for a CUDA stream. More...

#include <stream.hpp>

Collaboration diagram for cuda::stream_t:
Collaboration graph


class  enqueue_t
 A gadget through which commands are enqueued on the stream. More...

Public Types

enum  : bool {
  doesnt_synchronizes_with_default_stream = false,
  does_synchronize_with_default_stream = true

Public Member Functions

stream::handle_t handle () const noexcept
 The raw CUDA handle for a stream which this class wraps.
context::handle_t context_handle () const noexcept
 The raw CUDA handle for the context in which the represented stream is defined.
device::id_t device_id () const noexcept
 The raw CUDA ID for the device w.r.t. which the stream is defined.
device_t device () const noexcept
 The device w.r.t. which the stream is defined.
context_t context () const noexcept
 The context in which this stream was defined.
bool is_owning () const noexcept
 True if this wrapper is responsible for telling CUDA to destroy the stream upon the wrapper's own destruction.
bool synchronizes_with_default_stream () const
 When true, work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and there is no implicit synchronization performed between it and stream 0.
stream::priority_t priority () const
bool has_work_remaining () const
 Determines whether all work on this stream has been completed. More...
bool is_clear () const
 The opposite of has_work() More...
bool query () const
 An alias for is_clear() - to conform to how the CUDA runtime API names this functionality.
void synchronize () const
 Block or busy-wait until all previously-scheduled work on this stream has been completed.
 stream_t (const stream_t &other) noexcept
 stream_t (stream_t &&other) noexcept
stream_toperator= (const stream_t &other)=delete
stream_toperator= (stream_t &other) noexcept

Public Attributes

enqueue_t enqueue { *this }


class enqueue_t
stream_t stream::wrap (device::id_t device_id, context::handle_t context_handle, stream::handle_t stream_handle, bool take_ownership, bool hold_pc_refcount_unit) noexcept
bool operator== (const stream_t &lhs, const stream_t &rhs) noexcept

Detailed Description

Proxy class for a CUDA stream.

a stream is specific to a context, and thus also specific to a device.
This class is a "reference type", not a "value type". Therefore, making changes to properties of the stream is a const-respecting operation on this class.

Member Function Documentation

◆ has_work_remaining()

bool cuda::stream_t::has_work_remaining ( ) const

Determines whether all work on this stream has been completed.

having work is not the same as being busy executing that work!
What if there are incomplete operations, but they're all waiting on something on another queue? Should the queue count as "busy" then?
true if there is still work pending, false otherwise

◆ is_clear()

bool cuda::stream_t::is_clear ( ) const

The opposite of has_work()

true if there is no work pending, false if all previously-scheduled work has been completed

Friends And Related Function Documentation

◆ operator==

bool operator== ( const stream_t lhs,
const stream_t rhs 
two stream proxies may be equal even though one is the owning reference and the other isn't, or if only one holds a primary context reference unit and the other doesn't.

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