Skip to content

Commit

Permalink
Fix wrong socket number retrieval for non-english system (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spycsh authored Jan 12, 2024
1 parent 2f2c9a2 commit 5b2a887
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neural_compressor/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"'

Expand Down Expand Up @@ -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"'

Expand Down

0 comments on commit 5b2a887

Please sign in to comment.