GpuDiagnosticsOptions

Options & Configuration · AiDotNet.Configuration

Options for controlling GPU backend diagnostic output visibility. Addresses github.com/ooples/AiDotNet#1122 — all three requested controls (environment variable, static configuration, ILogger / custom sink) are reachable through this options class or the underlying GpuDiagnosticsConfig static facade.

For Beginners

If your AI application is printing lots of [OpenClBackend] Compiling kernels... messages, pass new GpuDiagnosticsOptions { Level = GpuDiagnosticLevel.Silent } to the builder’s ConfigureGpuDiagnostics method. If you want them routed through your logger instead, set Sink.

How It Works

AiDotNet’s GPU backends (OpenCL, HIP, CUDA) emit status messages during device discovery, kernel compilation, and availability checks. This options class lets applications configure the verbosity and routing of that output via the fluent ConfigureGpuDiagnostics builder method.

All properties are nullable — null means “don’t change the current setting”, so passing an empty options instance is a no-op. This matches the AiDotNet facade pattern (TelemetryConfig / ProfilingConfig).

Example

var builder = new AiModelBuilder<double, Matrix<double>, Vector<double>>();
// Silence all GPU diagnostics.
builder.ConfigureGpuDiagnostics(new() { Level = GpuDiagnosticLevel.Silent });
            
// Verbose for troubleshooting.
builder.ConfigureGpuDiagnostics(new() { Level = GpuDiagnosticLevel.Verbose });
            
// Route through an ILogger. Any ILogger works; NullLogger keeps the example self-contained.
Microsoft.Extensions.Logging.ILogger logger =
    Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance;
builder.ConfigureGpuDiagnostics(new()
{
    Level = GpuDiagnosticLevel.Minimal,
    Sink = logger.ToSink()
});

Constructors

Constructor Summary
GpuDiagnosticsOptions()

Properties

Property Summary
GpuDiagnosticLevel? Level { get; set; } Verbosity level.
GpuDiagnosticSink Sink { get; set; } Optional sink that receives diagnostic messages.
bool? Verbose { get; set; } Legacy bool-level flag.