From 32eb0a7fcffc748560a2c14528bb7d303f209978 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Wed, 22 Nov 2017 16:25:51 +0800 Subject: [PATCH] fix v2 init issue on Mac --- python/paddle/v2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/v2/__init__.py b/python/paddle/v2/__init__.py index 4edc96437f8..33a0829ba8d 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()) -- GitLab