cuda::experimental::event

Defined in include/cuda/experimental/__event/event.cuh

class event : public cuda::experimental::event_ref

An owning wrapper for an untimed cudaEvent_t.

Subclassed by cuda::experimental::timed_event

Public Types

enum class flags : unsigned int

Flags to use when creating the event.

Values:

enumerator none
enumerator blocking_sync
enumerator interprocess
using value_type = ::cudaEvent_t

Public Functions

inline explicit event(stream_ref __stream, flags __flags = flags::none)

Construct a new event object with timing disabled, and record the event in the specified stream.

Throws

cuda_error – if the event creation fails.

inline explicit constexpr event(uninit_t) noexcept

Construct a new event object into the moved-from state.

Post

get() returns cudaEvent_t().

inline constexpr event(event &&__other) noexcept

Move-construct a new event object.

Parameters

__other

Post

__other is in a moved-from state.

event(const event&) = delete
inline ~event()

Destroy the event object.

Note

If the event fails to be destroyed, the error is silently ignored.

inline event &operator=(event &&__other) noexcept

Move-assign an event object.

Parameters

__other

Post

__other is in a moved-from state.

event &operator=(const event&) = delete
inline constexpr ::cudaEvent_t release() noexcept

Retrieve the native cudaEvent_t handle and give up ownership.

Returns

cudaEvent_t The native handle being held by the event object.

Post

The event object is in a moved-from state.

inline constexpr flags operator|(flags __lhs, flags __rhs) noexcept
inline void record(stream_ref __stream) const

Records an event on the specified stream.

Parameters

__stream

Throws

cuda_error – if the event record fails

inline void wait() const

Waits until all the work in the stream prior to the record of the event has completed.

Throws

cuda_error – if waiting for the event fails

inline bool is_done() const

Checks if all the work in the stream prior to the record of the event has completed.

If is_done returns true, calling wait() on this event will return immediately

Throws

cuda_error – if the event query fails

inline constexpr ::cudaEvent_t get() const noexcept

Retrieve the native cudaEvent_t handle.

Returns

cudaEvent_t The native handle being held by the event_ref object.

inline explicit constexpr operator bool() const noexcept

Checks if the event_ref is valid.

Returns

true if the event_ref is valid, false otherwise.

inline constexpr bool operator==(event_ref __lhs, event_ref __rhs) noexcept

Compares two event_refs for equality.

Note

Allows comparison with cudaEvent_t due to implicit conversion to event_ref.

Parameters
Returns

true if lhs and rhs refer to the same cudaEvent_t object.

inline constexpr bool operator!=(event_ref __lhs, event_ref __rhs) noexcept

Compares two event_refs for inequality.

Note

Allows comparison with cudaEvent_t due to implicit conversion to event_ref.

Parameters
Returns

true if lhs and rhs refer to different cudaEvent_t objects.

Public Static Functions

static inline event from_native_handle(::cudaEvent_t __evnt) noexcept

Construct an event object from a native cudaEvent_t handle.

Note

The constructed event object takes ownership of the native handle.

Parameters

__evnt – The native handle

Returns

event The constructed event object

static event from_native_handle(int) = delete
static event from_native_handle(cuda::std::nullptr_t) = delete