From 8fde3923932fa55979661572b82ffd25b1c33f87 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 6 Mar 2019 13:30:00 +0100 Subject: improve thread scaling --- src/benchmark.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/benchmark.py') diff --git a/src/benchmark.py b/src/benchmark.py index 7d3207f..edf5b16 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -28,16 +28,17 @@ class Benchmark (object): } @staticmethod - def scale_threads_for_cpus(factor): + def scale_threads_for_cpus(factor, steps=None): cpus = multiprocessing.cpu_count() max_threads = cpus * factor - steps = 1 - if max_threads > 40: - steps = 2 - if max_threads > 100: - steps = 5 - if max_threads > 200: - steps = 10 + if not steps: + steps = 1 + if max_threads >= 20 and max_threads < 50: + steps = 2 + if max_threads >= 50 max_threads < 100: + steps = 5 + if max_threads >= 100: + steps = 10 # Special thread counts nthreads = set([1, int(cpus/2), cpus, cpus*factor]) -- cgit v1.2.3