From 7327a1a8444ba122662b744fe34f641e5cafc420 Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Tue, 10 Oct 2023 00:39:38 -0700 Subject: [PATCH] Add MaxThreadCount default --- Solver/SolverConfig.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Solver/SolverConfig.cs b/Solver/SolverConfig.cs index 5122f51..d261949 100644 --- a/Solver/SolverConfig.cs +++ b/Solver/SolverConfig.cs @@ -43,6 +43,9 @@ public readonly record struct SolverConfig ExplorationConstant = 4; MaxStepCount = 30; MaxRolloutStepCount = 99; + // Use 80% of all cores if less than 20 cores are available, otherwise use all but 4 cores. Keep at least 1 core. + MaxThreadCount = Math.Max(1, Math.Max(Environment.ProcessorCount - 4, (int)MathF.Floor(Environment.ProcessorCount * 0.8f))); + // Use 32 forks at minimum, or the number of cores, whichever is higher. ForkCount = Math.Max(Environment.ProcessorCount, 32); FurcatedActionCount = ForkCount / 2; StrictActions = true;