From bdc7bff4262dcf45c5be93b1d8812578380be381 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 24 Aug 2017 11:38:15 +0200 Subject: [PATCH] Report threads actually used by Blender The thing is, due to possibly NUMA or CPU groups used, number of Blender threads might be different from system number of threads. --- benchmark/configure.py | 6 ++++++ benchmark/foundation/benchrunner.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/benchmark/configure.py b/benchmark/configure.py index 280abe7..80ead43 100644 --- a/benchmark/configure.py +++ b/benchmark/configure.py @@ -138,6 +138,12 @@ def main(): scene.cycles.samples = 1 scene.cycles.aa_samples = 1 + # Report number of CPU threads used. + for scene in bpy.data.scenes: + print("CPU threads used: {}" . format(scene.render.threads)) + # TODO(sergey): What to do if there are multiple scenes? + break + # Configure the compute device. if args.benchmark_device_type == 'CPU': device_ok = setDeviceCPU(context, cpref) diff --git a/benchmark/foundation/benchrunner.py b/benchmark/foundation/benchrunner.py index a4992ba..adf057f 100644 --- a/benchmark/foundation/benchrunner.py +++ b/benchmark/foundation/benchrunner.py @@ -145,13 +145,17 @@ def benchmarkGetDeviceInfo(ctx): # Parse output device_type = "" compute_devices = [] + num_cpu_threads = 0 for line in lines: if line.startswith("Compute device type:"): device_type = line.split(':', 1)[1].strip() elif line.startswith("Using compute device:"): compute_devices.append(line.split(':', 1)[1].strip()) + elif line.startswith("CPU threads used:"): + num_cpu_threads = int(line.split(':', 1)[1].strip()) return {"device_type": device_type, - "compute_devices": compute_devices} + "compute_devices": compute_devices, + "num_cpu_threads": num_cpu_threads} def benchmarkPrintDeviceInfo(ctx):