We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e8c236b + c965703 commit 73e94b5Copy full SHA for 73e94b5
Utilities/Tools/jobutils2.sh
@@ -395,8 +395,11 @@ getNumberOfPhysicalCPUCores() {
395
fi
396
else
397
# Do something under GNU/Linux platform
398
- CORESPERSOCKET=`lscpu | grep "Core(s) per socket" | awk '{print $4}'`
399
- SOCKETS=`lscpu | grep "Socket(s)" | awk '{print $2}'`
+ #
+ # Notice the human readable output of lscpu depends on the version and wether or not you
400
+ # are inside a container. The following should be more stable.
401
+ CORESPERSOCKET=$(lscpu -p=cpu,socket | grep ,0 | sort | uniq | wc -l)
402
+ SOCKETS=$(lscpu -p=socket | grep -e "^[0-9]" | sort | uniq | wc -l)
403
404
N=$((${CORESPERSOCKET}*${SOCKETS}))
405
echo "${N}"
0 commit comments