cuda::experimental::stream_ref

Defined in include/cuda/experimental/__stream/stream_ref.cuh

struct stream_ref : public stream_ref

A non-owning wrapper for cudaStream_t.

Subclassed by cuda::experimental::stream

Public Functions

stream_ref() = delete
inline constexpr stream_ref(value_type __stream) noexcept

Wrap a native ::cudaStream_t in a stream_ref.

Post

this->get() == __stream

inline constexpr stream_ref(const ::cuda::stream_ref &__other) noexcept

Converting constructor from ::cuda::stream_ref.

Post

*this == __other

stream_ref(int) = delete

Disallow construction from an int, e.g., 0.

stream_ref(cuda::std::nullptr_t) = delete

Disallow construction from nullptr.

inline event record_event(event::flags __flags = event::flags::none) const

Create a new event and record it into this stream.

Throws

cuda_error – if event creation or record failed

Returns

A new event that was recorded into this stream

inline timed_event record_timed_event(event::flags __flags = event::flags::none) const

Create a new timed event and record it into this stream.

Throws

cuda_error – if event creation or record failed

Returns

A new timed event that was recorded into this stream

inline void wait() const

Synchronizes the wrapped stream.

Throws

cuda::cuda_error – if synchronization fails.

inline void wait(event_ref __ev) const

Make all future work submitted into this stream depend on completion of the specified event.

Parameters

__ev – Event that this stream should wait for

Throws

cuda_error – if inserting the dependency fails

inline void wait(stream_ref __other) const

Make all future work submitted into this stream depend on completion of all work from the specified stream.

Parameters

__other – Stream that this stream should wait for

Throws

cuda_error – if inserting the dependency fails

inline logical_device logical_device() const

Get the logical device under which this stream was created.

Compared to device() member function the returned logical_device will hold a green context for streams created under one.

inline device_ref device() const

Get device under which this stream was created.

Note: In case of a stream created under a green_context the device on which that green_context was created is returned

Throws

cuda_error – if device check fails