From 6482dd123dcd4b2d00052aa439b7da73f00048d1 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 21 Oct 2026 05:43:37 -0700 Subject: [PATCH] llm, change ollama_threads to use a better method of determining the number of cores to test, also fix output. --- tasks/workstation/linux/software/llm.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index 4d65e20..1fd8aea 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -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