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.
This commit is contained in:
2017-08-24 11:38:15 +02:00
parent d538682ce4
commit bdc7bff426
2 changed files with 11 additions and 1 deletions

View File

@@ -138,6 +138,12 @@ def main():
scene.cycles.samples = 1 scene.cycles.samples = 1
scene.cycles.aa_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. # Configure the compute device.
if args.benchmark_device_type == 'CPU': if args.benchmark_device_type == 'CPU':
device_ok = setDeviceCPU(context, cpref) device_ok = setDeviceCPU(context, cpref)

View File

@@ -145,13 +145,17 @@ def benchmarkGetDeviceInfo(ctx):
# Parse output # Parse output
device_type = "" device_type = ""
compute_devices = [] compute_devices = []
num_cpu_threads = 0
for line in lines: for line in lines:
if line.startswith("Compute device type:"): if line.startswith("Compute device type:"):
device_type = line.split(':', 1)[1].strip() device_type = line.split(':', 1)[1].strip()
elif line.startswith("Using compute device:"): elif line.startswith("Using compute device:"):
compute_devices.append(line.split(':', 1)[1].strip()) 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, return {"device_type": device_type,
"compute_devices": compute_devices} "compute_devices": compute_devices,
"num_cpu_threads": num_cpu_threads}
def benchmarkPrintDeviceInfo(ctx): def benchmarkPrintDeviceInfo(ctx):