You need to sign in or sign up before continuing.
未验证 提交 e4397c4a 编写于 作者: T tensor-tang 提交者: GitHub

Merge pull request #5828 from tensor-tang/develop

fix v2 init issue on Mac
...@@ -91,14 +91,14 @@ def set_omp_mkl_env_vars(trainer_count): ...@@ -91,14 +91,14 @@ def set_omp_mkl_env_vars(trainer_count):
.read()) .read())
return num_sockets * num_cores_per_socket return num_sockets * num_cores_per_socket
else: else:
cmds = {"Darwin": "sysctl hw.physicalcpu"} cmds = {"Darwin": "sysctl -n hw.physicalcpu"}
return int(os.popen(cmds.get(platform.system(), "expr 1")).read()) return int(os.popen(cmds.get(platform.system(), "expr 1")).read())
def num_logical_processors(): def num_logical_processors():
'''Get the number of logical processors''' '''Get the number of logical processors'''
cmds = { cmds = {
"Linux": "grep \"processor\" /proc/cpuinfo|sort -u|wc -l", "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()) return int(os.popen(cmds.get(platform.system(), "expr 1")).read())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册