Merge pull request #5828 from tensor-tang/develop

fix v2 init issue on Mac
release/0.11.0
tensor-tang 7 years ago committed by GitHub
commit e4397c4aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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())

Loading…
Cancel
Save