We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 217c6a3 + 966a442 commit 1e6f85eCopy full SHA for 1e6f85e
python/paddle/v2/__init__.py
@@ -83,11 +83,10 @@ def num_physical_cores():
83
'''Get the number of physical cores'''
84
if platform.system() == "Linux":
85
num_sockets = int(
86
- os.popen("lscpu |grep \"Socket\" |awk -F':' '{print $2}'|xargs")
+ os.popen("grep 'physical id' /proc/cpuinfo | sort -u | wc -l")
87
.read())
88
num_cores_per_socket = int(
89
- os.popen(
90
- "lscpu |grep \"per socket\" |awk -F':' '{print $2}'|xargs")
+ os.popen("grep 'core id' /proc/cpuinfo | sort -u | wc -l")
91
92
return num_sockets * num_cores_per_socket
93
else:
0 commit comments