Class CudaStreamManagerProduction
- Namespace
- DotCompute.Backends.CUDA.Execution
- Assembly
- DotCompute.Backends.CUDA.dll
Production-grade CUDA stream manager with stream pools, priorities, callbacks, and graph capture.
public sealed class CudaStreamManagerProduction : IDisposable
- Inheritance
-
CudaStreamManagerProduction
- Implements
- Inherited Members
- Extension Methods
Constructors
CudaStreamManagerProduction(CudaContext, ILogger<CudaStreamManagerProduction>, int)
Initializes a new instance of the CudaStreamManagerProduction class.
public CudaStreamManagerProduction(CudaContext context, ILogger<CudaStreamManagerProduction> logger, int maxPoolSize = 32)
Parameters
contextCudaContextThe context.
loggerILogger<CudaStreamManagerProduction>The logger.
maxPoolSizeintThe max pool size.
Properties
IsCapturing
Gets whether graph capture is currently active.
public bool IsCapturing { get; }
Property Value
PrioritiesSupported
Gets whether stream priorities are supported.
public bool PrioritiesSupported { get; }
Property Value
Statistics
Gets stream statistics.
public StreamStatistics Statistics { get; }
Property Value
Methods
AddCallback(nint, Action, string?)
Adds a callback to a stream.
public void AddCallback(nint stream, Action callback, string? description = null)
Parameters
BeginCapture(nint, CudaGraphCaptureMode)
Begins graph capture on a stream.
public void BeginCapture(nint stream, CudaGraphCaptureMode mode = CudaGraphCaptureMode.Global)
Parameters
streamnintmodeCudaGraphCaptureMode
CreateStream(string?, StreamPriority, StreamFlags)
Creates or gets a stream with the specified priority.
public nint CreateStream(string? name = null, StreamPriority priority = StreamPriority.Normal, StreamFlags flags = StreamFlags.NonBlocking)
Parameters
namestringpriorityStreamPriorityflagsStreamFlags
Returns
Dispose()
Performs dispose.
public void Dispose()
EndCapture()
Ends graph capture and returns the captured graph.
public nint EndCapture()
Returns
InstantiateGraph(nint)
Creates an executable graph instance from a captured graph.
public nint InstantiateGraph(nint graph)
Parameters
graphnint
Returns
IsStreamComplete(nint)
Queries if a stream has completed all operations.
public bool IsStreamComplete(nint stream)
Parameters
streamnint
Returns
LaunchGraph(nint, nint)
Launches a graph on a stream.
public void LaunchGraph(nint graphExec, nint stream)
Parameters
RecordEvent(nint, nint)
Records an event on a stream.
public void RecordEvent(nint eventHandle, nint stream)
Parameters
ReturnStream(nint)
Returns a stream to the pool.
public void ReturnStream(nint stream)
Parameters
streamnint
SynchronizeAsync(CancellationToken)
Asynchronously synchronizes all active streams.
public ValueTask SynchronizeAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- ValueTask
A task that completes when all streams are synchronized.
SynchronizeStream(nint)
Synchronizes a stream.
public void SynchronizeStream(nint stream)
Parameters
streamnint
WaitEvent(nint, nint)
Waits for an event on a stream.
public void WaitEvent(nint stream, nint eventHandle)