GpuAccelerationConfig
Options & Configuration · AiDotNet.Engines
Configuration for GPU-accelerated training and inference.
For Beginners
GPU makes training 10-100x faster for large models by using your graphics card for parallel computation. This config lets you:
- Enable/disable GPU acceleration
- Choose which GPU to use (if you have multiple)
- Control when to use GPU vs CPU based on operation size
- Enable debug logging to see what’s running where
How It Works
Phase B: GPU Acceleration Configuration
This configuration controls when and how GPU acceleration is used during training and inference. The default settings work well for most desktop GPUs - just call ConfigureGpuAcceleration() without parameters for automatic GPU detection and sensible defaults.
Constructors
| Constructor | Summary |
|---|---|
GpuAccelerationConfig() |
Creates a configuration with default GPU settings. |
Properties
| Property | Summary |
|---|---|
GpuDeviceType DeviceType { get; set; } |
Gets or sets the GPU device type to use (default: Auto). |
GpuExecutionModeConfig ExecutionMode { get; set; } |
Gets or sets the GPU execution mode (default: Auto). |
GpuUsageLevel UsageLevel { get; set; } |
Gets or sets the GPU usage level (default: Default). |
bool CacheCompiledGraphs { get; set; } |
Gets or sets whether to cache compiled execution graphs (default: true). |
bool EnableAutoFusion { get; set; } |
Gets or sets whether to enable automatic kernel fusion (default: true). |
bool EnableComputeTransferOverlap { get; set; } |
Gets or sets whether to enable compute/transfer overlap (default: true). |
bool EnableForInference { get; set; } |
Gets or sets whether to enable GPU acceleration for inference (prediction) as well as training (default: true). |
bool EnableGpuPersistence { get; set; } |
Gets or sets whether to enable GPU persistence for neural network weights (default: true). |
bool EnableGraphCompilation { get; set; } |
Gets or sets whether to enable execution graph compilation (default: true). |
bool EnablePrefetch { get; set; } |
Gets or sets whether to enable data prefetching (default: true). |
bool EnableProfiling { get; set; } |
Gets or sets whether to enable GPU profiling (default: false). |
bool VerboseLogging { get; set; } |
Gets or sets whether to enable verbose logging of GPU operations (default: false). |
double MaxGpuMemoryUsage { get; set; } |
Gets or sets the maximum GPU memory usage fraction (default: 0.8). |
int DeviceIndex { get; set; } |
Gets or sets the GPU device index to use if multiple GPUs are available (default: 0). |
int MaxComputeStreams { get; set; } |
Gets or sets the maximum number of compute streams (default: 3). |
int MinGpuElements { get; set; } |
Gets or sets the minimum number of elements to use GPU (default: 4096). |
int TransferStreams { get; set; } |
Gets or sets the number of transfer streams (default: 2). |
Methods
| Method | Summary |
|---|---|
string ToString() |
Gets a string representation of this configuration. |