llm, change ollama_threads to use a better method of determining the number of cores to test, also fix output.

This commit is contained in:
me committed 2026-10-21 05:43:37 -07:00
1 parent 74789ba70c
commit 6482dd123d
1 file changed
+7 -2
+7 -2
View File
@@ -922,11 +922,16 @@
context=',"num_ctx":'$num_ctx''
fi
# Physical CPU Count (no longer using ansible_processor_vcpus, {{ ansible_processor_vcpus }})
# Will be something like 0-7, then get expanded to 0 1 2 3 4 5 6 7.
# Runnning with 0 causes default behavior, 1 per physical core, 8!
cores=$(cat /sys/devices/cpu_core/cpus | tr ',' '\n' | sed 's/-/ /' | xargs -L1 seq)
echo " Stopping all ollama usage..."
sudo sv restart ollama >/dev/null 2>&1
# Benchmark Thread Count
for t in {1..{{ ansible_processor_vcpus | int }}}; do
for t in $cores; do
start=$SECONDS
echo -n "`date` - Model $model w/ $t Thread(s): "
@@ -938,7 +943,7 @@
ctx="`ollama ps | grep $model | awk '{print $7}'`"
time=$(( $finish - $start ))
echo ", tokens/sec: $speed @ context=$ctx, time: $time secs"
echo "tokens/sec: $speed @ context=$ctx, time: $time secs"
ollama stop $model >/dev/null 2>&1
done