better calculate number of threads to use

This commit is contained in:
Sean Wheller 2019-08-10 19:08:35 +02:00
parent 7837c86a98
commit 097d5a426a
2 changed files with 9 additions and 5 deletions

View File

@ -50,9 +50,13 @@ check_cpu () {
}
calc_threads () {
# Each thread needs 2048 byte (2 Megabyte)
# Calculate number of threads supported with L3 cache size
_ENV_THREAD_QTY=$(( ($_ENV_CORE_L3/2048)/1000 ))
# Affine number of threads for _CPU_CN
_COUNTER="$(( $_ENV_CORE-1 ))"
_COUNTER="$(( $_ENV_THREAD_QTY-1 ))"
_ENV_CPU_THREAD_AFFINITY="$(seq -s " " 0 $_COUNTER)"
@ -69,7 +73,7 @@ calc_hugepages () {
sudo sysctl -p
else
# Set value in current env
sudo sysctl -w vm.nr_hugepages="$_ENV_CORE"
sudo sysctl -w vm.nr_hugepages="$_ENV_THREAD_QTY"
# Add value to sysctl
sudo sysctl -p
fi

View File

@ -1,11 +1,11 @@
#!/bin/bash
_DEBUG=true
_DEBUG=$1
if $_DEBUG; then
set -x
else
set +x
else
set -x
fi
# Set that user passwdless sudo