Class GpuDetector
- Namespace
- JD.AI.Core.LocalModels
- Assembly
- JD.AI.Core.dll
Detects available GPU backends for LLamaSharp inference at runtime.
public static class GpuDetector
- Inheritance
-
GpuDetector
- Inherited Members
Methods
Detect()
Detects the best available GPU backend. Order: CUDA → Metal (macOS) → CPU fallback.
public static GpuBackend Detect()
Returns
RecommendGpuLayers(GpuBackend, long)
Returns a recommended GPU layer count based on the backend and model size. Returns -1 for "all layers" when GPU is available.
public static int RecommendGpuLayers(GpuBackend backend, long modelSizeBytes)
Parameters
backendGpuBackendmodelSizeByteslong
Returns
Reset()
Resets the cached detection result (for testing).
public static void Reset()