event_ref#

class event_ref#

An non-owning wrapper for an untimed cudaEvent_t.

Subclassed by event

Public Types

using value_type = ::cudaEvent_t#

Public Functions

inline constexpr event_ref(::cudaEvent_t __evnt) noexcept#

Construct a new event_ref object from a cudaEvent_t

This constructor provides an implicit conversion from cudaEvent_t

Note

: It is the callers responsibility to ensure the event_ref does not outlive the event denoted by the cudaEvent_t handle.

Post:

get() == __evnt

event_ref(int) = delete#

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

event_ref(::cuda::std::nullptr_t) = delete#

Disallow construction from nullptr.

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 sync() const#

Synchronizes the event.

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 sync() 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.

Friends

inline friend 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 friend 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.