Produce benchmark JSON schema v2

- No more '(Display)' strings in the GPU names, but store devices as
  `{'name': name, 'type': 'CPU/CUDA/OPENCL', 'is_display': bool}`
- Introduces testing with py.test & pipenv. The test suite is far from
  complete, though.
This commit is contained in:
2018-08-28 12:11:01 +02:00
parent 34dd5eec25
commit 4726ee0c9c
12 changed files with 356 additions and 181 deletions

View File

@@ -2,7 +2,6 @@
import bpy
def setDeviceCPU(context, cpref):
cpref.compute_device_type = 'NONE'
return True
@@ -123,6 +122,7 @@ def setDeviceGPU(context,
def logComputeDevices(cpref):
import json
device_type = cpref.compute_device_type
if device_type == 'NONE':
device_type = 'CPU'
@@ -131,13 +131,18 @@ def logComputeDevices(cpref):
import _cycles
for device in _cycles.available_devices():
if device[1] == 'CPU':
print("Using compute device: {}" . format(device[0]))
info = {'name': device[0]}
print("Using compute device: {}" . format(json.dumps(info, sort_keys=True)))
else:
for device in cpref.devices:
if device.type != device_type:
if device.type != device_type or not device.use:
continue
if device.use:
print("Using compute device: {}" . format(device.name))
info = {
'name': device.name.replace(' (Display)', ''),
'is_display': '(Display)' in device.name,
}
print("Using compute device: {}" . format(json.dumps(info, sort_keys=True)))
def logSystemInfo(cpref):
@@ -148,8 +153,10 @@ def logSystemInfo(cpref):
"name": device.name.replace(" (Display)", ""),
"type": device.type,
}
if device.type != 'CPU':
info_device["is_display"] = '(Display)' in device.name
info_devices.append(info_device)
print("Benchmark Devices: {}" . format(json.dumps(info_devices)))
print("Benchmark Devices: {}" . format(json.dumps(info_devices, sort_keys=True)))
def main():