Skip to content

Commit 16f1a93

Browse files
authored
Cleanup jobutils2 to work on ARM (AliceO2Group#14901)
1 parent 07e63da commit 16f1a93

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Utilities/Tools/jobutils2.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,13 @@ getNumberOfPhysicalCPUCores() {
395395
fi
396396
else
397397
# 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}'`
398+
#
399+
# Gets the cores per socket by counting unique cores on socket 0.
400+
# Gets sockets by counting unique socket ids. The grepping is done in any case to avoid matching comments.
401+
CORESPERSOCKET=$(lscpu -p=cpu,socket | grep "^[0-9]\+,0" | sort | uniq | wc -l)
402+
SOCKETS=$(lscpu -p=socket | grep -e "^[0-9]" | sort | uniq | wc -l)
400403
fi
401-
N=`bc <<< "${CORESPERSOCKET}*${SOCKETS}"`
404+
N=$((${CORESPERSOCKET}*${SOCKETS}))
402405
echo "${N}"
403406
}
404407

0 commit comments

Comments
 (0)