diff --git a/benchmark/foundation/system_info.py b/benchmark/foundation/system_info.py index 3c5e7e1..be61a6c 100644 --- a/benchmark/foundation/system_info.py +++ b/benchmark/foundation/system_info.py @@ -56,6 +56,23 @@ def getBlenderVersion(ctx): return info +def getNumPhysicalCPUs_Linux(): + ids = set() + with open("/proc/cpuinfo") as f: + for line in f.readlines(): + if line.startswith("physical id"): + id = int(line.split(":", 1)[1]) + ids.add(id) + return len(ids) + + +def getNumPhysicalCPUs(): + if sys.platform == 'linux': + return getNumPhysicalCPUs_Linux() + else: + raise Exception("Needs implementation") + + def gatherSystemInfo(ctx): system_info = {} system_info['bitness'] = platform.architecture()[0] @@ -71,6 +88,7 @@ def gatherSystemInfo(ctx): system_info['cpu_brand'] = cpu_info['brand'] system_info["num_cpu_cores"] = psutil.cpu_count(logical=False) system_info["num_cpu_threads"] = psutil.cpu_count(logical=True) + system_info["num_cpu_sockets"] = getNumPhysicalCPUs() system_info['devices'] = _getBlenderDeviceInfo(ctx) # TODO(sergey): query number of CPUs and threads. return system_info