Skip to content

Commit e4397c4

Browse files
authored
Merge pull request #5828 from tensor-tang/develop
fix v2 init issue on Mac
2 parents 6577760 + 32eb0a7 commit e4397c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/paddle/v2/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ def num_physical_cores():
9191
.read())
9292
return num_sockets * num_cores_per_socket
9393
else:
94-
cmds = {"Darwin": "sysctl hw.physicalcpu"}
94+
cmds = {"Darwin": "sysctl -n hw.physicalcpu"}
9595
return int(os.popen(cmds.get(platform.system(), "expr 1")).read())
9696

9797
def num_logical_processors():
9898
'''Get the number of logical processors'''
9999
cmds = {
100100
"Linux": "grep \"processor\" /proc/cpuinfo|sort -u|wc -l",
101-
"Darwin": "sysctl hw.logicalcpu"
101+
"Darwin": "sysctl -n hw.logicalcpu"
102102
}
103103
return int(os.popen(cmds.get(platform.system(), "expr 1")).read())
104104

0 commit comments

Comments
 (0)