Table of Contents

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, IDisposable

Inheritance

Implements

Inherited Members

Constructors

CudaEvent(bool)

Creates a new CUDA event.

public CudaEvent(bool disableTiming = true)

Parameters

disableTiming bool

When true (default) timing is disabled, resulting in lower overhead. Set to false to enable NVMathNet.CudaEvent.ElapsedMilliseconds(NVMathNet.CudaEvent).

Properties

Handle

The raw CUDA event handle (cudaEvent_t).

public nint Handle { get; }

Property Value

nint

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

start CudaEvent

Returns

float

Record(CudaStream)

Records this event on stream.

public void Record(CudaStream stream)

Parameters

stream CudaStream

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

cancellationToken CancellationToken

Returns

Task