From 21cfeb83cbcd065a5d096c3a84da3deab256ea07 Mon Sep 17 00:00:00 2001 From: Luke Nezda Date: Tue, 27 Feb 2024 00:31:27 -0600 Subject: [PATCH] intel mac support (#1503) Signed-off-by: Luke Nezda --- neural_compressor/utils/utility.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neural_compressor/utils/utility.py b/neural_compressor/utils/utility.py index 81dc462af64..36d980eb16d 100644 --- a/neural_compressor/utils/utility.py +++ b/neural_compressor/utils/utility.py @@ -276,6 +276,8 @@ def get_number_of_sockets(self) -> int: 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"' + elif psutil.MACOS: # pragma: no cover + cmd = "sysctl -n machdep.cpu.core_count" with subprocess.Popen( args=cmd, @@ -918,6 +920,8 @@ def get_number_of_sockets() -> int: cmd = "cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l" if sys.platform == "win32": cmd = 'wmic cpu get DeviceID | find /c "CPU"' + elif sys.platform == "darwin": # pragma: no cover + cmd = "sysctl -n machdep.cpu.core_count" proc = subprocess.Popen( args=cmd,