Skip to content
14 changes: 9 additions & 5 deletions src/AiDotNet.Tensors/Engines/AiDotNetEngine.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System;
using System.Diagnostics;
using AiDotNet.Tensors.Interfaces;

namespace AiDotNet.Tensors.Engines;

/// <summary>
Expand Down Expand Up @@ -116,18 +120,18 @@ public static bool AutoDetectAndConfigureGpu()
if (gpuEngine.SupportsGpu)
{
Current = gpuEngine;
Console.WriteLine($"[AiDotNet] GPU acceleration enabled: {gpuEngine.Name}");
Trace.WriteLine($"[AiDotNet] GPU acceleration enabled: {gpuEngine.Name}");
return true;
}

gpuEngine.Dispose();
Console.WriteLine("[AiDotNet] GPU not available, using CPU");
Trace.WriteLine("[AiDotNet] GPU not available, using CPU");
return false;
}
catch (Exception ex)
{
Console.WriteLine($"[AiDotNet] Failed to initialize DirectGpu: {ex.Message}");
Console.WriteLine("[AiDotNet] Falling back to CPU");
Trace.WriteLine($"[AiDotNet] Failed to initialize DirectGpu: {ex.Message}");
Trace.WriteLine("[AiDotNet] Falling back to CPU");
return false;
}
}
Expand All @@ -143,7 +147,7 @@ public static bool AutoDetectAndConfigureGpu()
public static void ResetToCpu()
{
Current = new CpuEngine();
Console.WriteLine("[AiDotNet] Reset to CPU engine");
Trace.WriteLine("[AiDotNet] Reset to CPU engine");
}

/// <summary>
Expand Down
Loading
Loading