提交 32eb0a7f 编写于 作者: T tensor-tang

fix v2 init issue on Mac

上级 53bd51e3
...@@ -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.
先完成此消息的编辑!
想要评论请 注册