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,