diff --git a/python/paddle/v2/__init__.py b/python/paddle/v2/__init__.py index 4edc96437f8490012cd58526d8f8b23983074048..33a0829ba8d635ebd68b50f3da07da958fb79dcb 100644 --- a/python/paddle/v2/__init__.py +++ b/python/paddle/v2/__init__.py @@ -91,14 +91,14 @@ def set_omp_mkl_env_vars(trainer_count): .read()) return num_sockets * num_cores_per_socket else: - cmds = {"Darwin": "sysctl hw.physicalcpu"} + cmds = {"Darwin": "sysctl -n hw.physicalcpu"} return int(os.popen(cmds.get(platform.system(), "expr 1")).read()) def num_logical_processors(): '''Get the number of logical processors''' cmds = { "Linux": "grep \"processor\" /proc/cpuinfo|sort -u|wc -l", - "Darwin": "sysctl hw.logicalcpu" + "Darwin": "sysctl -n hw.logicalcpu" } return int(os.popen(cmds.get(platform.system(), "expr 1")).read())