From 043598070d4cb62facfedf59a87adb9e2a3cb7da Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 5 Mar 2019 14:27:35 +0100 Subject: add function to scale thread to available cpus --- src/loop.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/loop.py') diff --git a/src/loop.py b/src/loop.py index 073a0ea..a3a9e1b 100644 --- a/src/loop.py +++ b/src/loop.py @@ -1,5 +1,3 @@ -import multiprocessing - from src.benchmark import Benchmark @@ -11,19 +9,8 @@ class Benchmark_Loop(Benchmark): self.cmd = "loop{binary_suffix} {nthreads} 1000000 {maxsize}" - cpus = multiprocessing.cpu_count() - steps = 1 - if cpus > 20: - steps = 2 - if cpus > 50: - steps = 5 - - # Special thread counts - nthreads = set([1, cpus/2, cpus, cpus*2]) - nthreads.update(range(steps, cpus * 2 + 1, steps)) - self.args = {"maxsize": [2 ** x for x in range(6, 16)], - "nthreads": list(nthreads)} + "nthreads": Benchmark.scale_threads_for_cpus(2)} self.requirements = ["loop"] super().__init__() -- cgit v1.2.3