pub struct CudaEventWrapper { /* private fields */ }Expand description
Implementations§
Source§impl CudaEventWrapper
impl CudaEventWrapper
Sourcepub fn new(ctx: &Arc<CudaContext>) -> GpuResult<Self>
pub fn new(ctx: &Arc<CudaContext>) -> GpuResult<Self>
Create a new event associated with the given device’s context.
The event is created with CU_EVENT_DISABLE_TIMING (the cudarc default
when None is passed for flags). Use [new_with_timing] if you need
elapsed-time queries.
Sourcepub fn new_with_timing(ctx: &Arc<CudaContext>) -> GpuResult<Self>
pub fn new_with_timing(ctx: &Arc<CudaContext>) -> GpuResult<Self>
Create a new event with timing enabled.
Required if you want to call elapsed_ms.
Timing events are slightly more expensive than non-timing events.
Sourcepub fn record(&self, stream: &CudaStream) -> GpuResult<()>
pub fn record(&self, stream: &CudaStream) -> GpuResult<()>
Record the current point in stream’s execution into this event.
After recording, synchronize will block until all
work submitted to stream before this call has completed.
§Errors
Returns Err if the stream belongs to a different CUDA context than
the event, or if the CUDA driver reports an error.
Sourcepub fn synchronize(&self) -> GpuResult<()>
pub fn synchronize(&self) -> GpuResult<()>
Block the calling CPU thread until all work recorded in this event has completed on the GPU.
§Errors
Returns Err if the CUDA driver reports an error (e.g., a previous
async kernel launch failed).
Sourcepub fn query(&self) -> GpuResult<bool>
pub fn query(&self) -> GpuResult<bool>
Query whether all work recorded in this event has completed.
Returns Ok(true) if complete, Ok(false) if still in progress.
This is a non-blocking check.
Sourcepub fn wait_on(&self, stream: &CudaStream) -> GpuResult<()>
pub fn wait_on(&self, stream: &CudaStream) -> GpuResult<()>
Make stream wait for all work recorded in this event to complete
before executing any subsequent operations.
This is a GPU-side wait — it does not block the CPU.
§Errors
Returns Err if the stream and event belong to different CUDA contexts.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CudaEventWrapper
impl RefUnwindSafe for CudaEventWrapper
impl Send for CudaEventWrapper
impl Sync for CudaEventWrapper
impl Unpin for CudaEventWrapper
impl UnsafeUnpin for CudaEventWrapper
impl UnwindSafe for CudaEventWrapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more