get_number_of_sockets should take locale into account
sonald opened this issue · comments
the function is in utility
this is the fixed version
def get_number_of_sockets() -> int:
env = {'LANGUAGE': 'en_US.UTF-8'}
"""Get number of sockets in platform."""
cmd = "lscpu | grep 'Socket(s)' | cut -d ':' -f 2"
if psutil.WINDOWS:
cmd = r'wmic cpu get DeviceID | C:\Windows\System32\find.exe /C "CPU"'
with subprocess.Popen(
args=cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=False,
env=env,
) as proc:
proc.wait()
if proc.stdout:
for line in proc.stdout:
return int(line.decode("utf-8", errors="ignore").strip())
return 0
Thanks @sonald , there is already a PR solving this issue: https://github.com/intel/neural-compressor/pull/1514/files, could you check whether it works for you?
Thanks @sonald , there is already a PR solving this issue: https://github.com/intel/neural-compressor/pull/1514/files, could you check whether it works for you?
this works.