From 548bf9e4341632b296b8f6c5d5b35798c1c0482b Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Mon, 5 Dec 2016 15:20:14 +0000 Subject: [PATCH] Improved setting of threads in benchmarking mode. --- gprMax/gprMax.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gprMax/gprMax.py b/gprMax/gprMax.py index 32eb7097..5035e6a3 100644 --- a/gprMax/gprMax.py +++ b/gprMax/gprMax.py @@ -202,11 +202,14 @@ def run_benchmark_sim(args, inputfile, usernamespace): """ # Number of threads to test - start from max physical CPU cores and divide in half until 1 - thread = psutil.cpu_count(logical=False) - threads = [thread] - while not thread % 2: - thread /= 2 + minthreads = 1 + maxthreads = psutil.cpu_count(logical=False) + threads = [] + while thread < maxthreads: threads.append(int(thread)) + thread *= 2 + threads.append(int(maxthreads)) + threads.reverse() benchtimes = np.zeros(len(threads)) numbermodelruns = len(threads)