From 5b2a88708eb5a63b760a5a109064e740b3d5297a Mon Sep 17 00:00:00 2001 From: Sihan Chen <39623753+Spycsh@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:29:10 +0800 Subject: [PATCH] Fix wrong socket number retrieval for non-english system (#1514) --- neural_compressor/utils/utility.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neural_compressor/utils/utility.py b/neural_compressor/utils/utility.py index 1777d52f6f5..81dc462af64 100644 --- a/neural_compressor/utils/utility.py +++ b/neural_compressor/utils/utility.py @@ -273,7 +273,7 @@ def cores_per_socket(self): def get_number_of_sockets(self) -> int: """Get number of sockets in platform.""" - cmd = "lscpu | grep 'Socket(s)' | cut -d ':' -f 2" + cmd = "cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l" if psutil.WINDOWS: cmd = r'wmic cpu get DeviceID | C:\Windows\System32\find.exe /C "CPU"' @@ -915,7 +915,7 @@ def dump_table_to_csv( def get_number_of_sockets() -> int: """Get number of sockets in platform.""" - cmd = "lscpu | grep 'Socket(s)' | cut -d ':' -f 2" + cmd = "cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l" if sys.platform == "win32": cmd = 'wmic cpu get DeviceID | find /c "CPU"'