Class CudaEvent
- Namespace
- NVMathNet
- Assembly
- NVMath.Net.dll
Wraps a CUDA event handle. Supports async waiting via NVMathNet.CudaEvent.SynchronizeAsync(System.Threading.CancellationToken).
public sealed class CudaEvent : IAsyncDisposable, IDisposableInheritance
Implements
Inherited Members
Constructors
CudaEvent(bool)
Creates a new CUDA event.
public CudaEvent(bool disableTiming = true)Parameters
disableTimingbool-
When
true(default) timing is disabled, resulting in lower overhead. Set tofalseto enable NVMathNet.CudaEvent.ElapsedMilliseconds(NVMathNet.CudaEvent).
Properties
Handle
The raw CUDA event handle (cudaEvent_t).
public nint Handle { get; }Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()Returns
- ValueTask
-
A task that represents the asynchronous dispose operation.
ElapsedMilliseconds(CudaEvent)
Returns the elapsed time in milliseconds between start
and this event. Both events must have been created with timing enabled.
public float ElapsedMilliseconds(CudaEvent start)Parameters
startCudaEvent
Returns
Record(CudaStream)
Records this event on stream.
public void Record(CudaStream stream)Parameters
streamCudaStream
Record()
Records this event on the null (default) stream.
public void Record()Synchronize()
Blocks the calling thread until this event completes. Prefer NVMathNet.CudaEvent.SynchronizeAsync(System.Threading.CancellationToken) in async code.
public void Synchronize()SynchronizeAsync(CancellationToken)
Returns a System.Threading.Tasks.Task that completes once all work preceding the last NVMathNet.CudaEvent.Record call has finished on the GPU.
public Task SynchronizeAsync(CancellationToken cancellationToken = default)Parameters
cancellationTokenCancellationToken