GPU warmup disabled when no GPU is in use.

This commit is contained in:
mlemanczyk committed 2026-01-22 15:08:13 +01:00
1 parent b9f2b08c78
commit c11a886197
3 files changed
+29 -8

No files matched your search

+13 -5
View File
@@ -33,12 +33,20 @@ public sealed class DivisorCycleCache
private DivisorCycleCache(int divisorCyclesBatchSize)
{
bool useGpu = EnvironmentConfiguration.MersenneDevice == ComputationDevice.Hybrid ||
EnvironmentConfiguration.MersenneDevice == ComputationDevice.Gpu ||
!EnvironmentConfiguration.UseCpuOrder;
_divisorCyclesBatchSize = Math.Max(1, divisorCyclesBatchSize);
var acceleratorIndex = AcceleratorPool.Shared.Rent();
_acceleratorIndex = acceleratorIndex;
Accelerator accelerator = AcceleratorPool.Shared.Accelerators[acceleratorIndex];
_accelerator = accelerator;
_gpuKernel = LoadKernel(accelerator);
if (useGpu)
{
var acceleratorIndex = AcceleratorPool.Shared.Rent();
_acceleratorIndex = acceleratorIndex;
Accelerator accelerator = AcceleratorPool.Shared.Accelerators[acceleratorIndex];
_accelerator = accelerator;
_gpuKernel = LoadKernel(accelerator);
}
_snapshot = MersenneDivisorCyclesCpu.Shared.ExportSmallCyclesSnapshot();
}