run games on same core for --proc 1

This commit is contained in:
2024-01-30 16:11:44 +01:00
committed by Stefan Steininger
parent 15ce6c5316
commit 2e3fdb62e9
3 changed files with 34 additions and 34 deletions

View File

@@ -48,11 +48,15 @@ class Evaluation:
def run(self, n_games=100, proc=mp.cpu_count()) -> List[EvaluationResult]:
proc = min(proc, mp.cpu_count())
with mp.Pool(proc) as pool:
args = [(self.engine_a, self.strategy_a, self.engine_b, self.strategy_b, self.limit, self.stockfish_path, self.lc0_path) for i
in
range(n_games)]
return pool.map(Evaluation._test_simulate, args)
arg = (self.engine_a, self.strategy_a, self.engine_b, self.strategy_b, self.limit, self.stockfish_path, self.lc0_path)
if proc > 1:
with mp.Pool(proc) as pool:
args = [arg for i in range(n_games)]
return pool.map(Evaluation._test_simulate, args)
return [
Evaluation._test_simulate(arg)
for _ in range(n_games)
]
@staticmethod
def _test_simulate(arg: Tuple[EngineEnum, StrategyEnum, EngineEnum, StrategyEnum, Limit, str, str]) -> EvaluationResult: