Skip to content

Commit 5b2a887

Browse files
authored
Fix wrong socket number retrieval for non-english system (#1514)
1 parent 2f2c9a2 commit 5b2a887

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

neural_compressor/utils/utility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def cores_per_socket(self):
273273

274274
def get_number_of_sockets(self) -> int:
275275
"""Get number of sockets in platform."""
276-
cmd = "lscpu | grep 'Socket(s)' | cut -d ':' -f 2"
276+
cmd = "cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l"
277277
if psutil.WINDOWS:
278278
cmd = r'wmic cpu get DeviceID | C:\Windows\System32\find.exe /C "CPU"'
279279

@@ -915,7 +915,7 @@ def dump_table_to_csv(
915915

916916
def get_number_of_sockets() -> int:
917917
"""Get number of sockets in platform."""
918-
cmd = "lscpu | grep 'Socket(s)' | cut -d ':' -f 2"
918+
cmd = "cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l"
919919
if sys.platform == "win32":
920920
cmd = 'wmic cpu get DeviceID | find /c "CPU"'
921921

0 commit comments

Comments
 (0)