Make bundle portable by bundling third party packages we need
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import json
|
||||
import multiprocessing
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from third_party import cpuinfo
|
||||
# Usually comes from third_party
|
||||
import cpuinfo
|
||||
import cpu_cores
|
||||
|
||||
|
||||
def _getBlenderDeviceInfo(ctx):
|
||||
@@ -55,28 +58,7 @@ 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()
|
||||
elif sys.platform == 'win32':
|
||||
# TODO(sergey): Currently all WIndows machines here are single socket.
|
||||
return 1
|
||||
else:
|
||||
raise Exception("Needs implementation")
|
||||
|
||||
|
||||
def gatherSystemInfo(ctx):
|
||||
import psutil
|
||||
system_info = {}
|
||||
system_info['bitness'] = platform.architecture()[0]
|
||||
system_info['machine'] = platform.machine()
|
||||
@@ -88,10 +70,11 @@ def gatherSystemInfo(ctx):
|
||||
# system_info['libc_version'] = "-".join(platform.libc_ver())
|
||||
# TODO(sergey): Make this to work on Windows and macOS
|
||||
cpu_info = cpuinfo.get_cpu_info()
|
||||
cores_info = cpu_cores.CPUCoresCounter.factory()
|
||||
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["num_cpu_cores"] = cores_info.get_physical_cores_count()
|
||||
system_info["num_cpu_threads"] = multiprocessing.cpu_count()
|
||||
system_info["num_cpu_sockets"] = cores_info.get_physical_processors_count()
|
||||
system_info['devices'] = _getBlenderDeviceInfo(ctx)
|
||||
# TODO(sergey): query number of CPUs and threads.
|
||||
return system_info
|
||||
|
Reference in New Issue
Block a user