Class CudaErrorHandler
- Namespace
- DotCompute.Backends.CUDA.ErrorHandling
- Assembly
- DotCompute.Backends.CUDA.dll
Production-grade CUDA error handler with retry logic, graceful degradation, and comprehensive error recovery strategies.
public sealed class CudaErrorHandler : IDisposable
- Inheritance
-
CudaErrorHandler
- Implements
- Inherited Members
- Extension Methods
Constructors
CudaErrorHandler(ILogger<CudaErrorHandler>, ErrorRecoveryOptions?)
Initializes a new instance of the CudaErrorHandler class.
public CudaErrorHandler(ILogger<CudaErrorHandler> logger, ErrorRecoveryOptions? options = null)
Parameters
loggerILogger<CudaErrorHandler>The logger.
optionsErrorRecoveryOptionsThe options.
Exceptions
- ArgumentNullException
logger
Properties
IsGpuAvailable
Gets whether GPU is currently available.
public bool IsGpuAvailable { get; }
Property Value
TimeSinceLastSuccess
Gets time since last successful operation.
public TimeSpan TimeSinceLastSuccess { get; }
Property Value
Methods
ClearStatistics()
Clears error statistics.
public void ClearStatistics()
Dispose()
Disposes the error handler resources.
public void Dispose()
ExecuteWithRetryAsync<T>(Func<Task<T>>, string, CancellationToken)
Executes a CUDA operation with comprehensive error handling.
public Task<T> ExecuteWithRetryAsync<T>(Func<Task<T>> operation, string operationName, CancellationToken cancellationToken = default)
Parameters
operationFunc<Task<T>>operationNamestringcancellationTokenCancellationToken
Returns
- Task<T>
Type Parameters
T