From 5620e5a223cdf3e0679163e27416a242dab42897 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 21 Oct 2026 02:57:12 -0700 Subject: [PATCH] llm, add function for benchmarking whether more threads adds latency. --- tasks/workstation/linux/software/llm.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tasks/workstation/linux/software/llm.yml b/tasks/workstation/linux/software/llm.yml index 41c68cf..b76573c 100644 --- a/tasks/workstation/linux/software/llm.yml +++ b/tasks/workstation/linux/software/llm.yml @@ -904,6 +904,23 @@ } alias ollama-sizes="ollama_sizes " alias model-sizes="ollama_sizes " + + function ollama_threads() { + model="$1" + if [[ -z $model ]]; then + model="qwen3.5:4b" + fi + # Benchmark Thread Count + for t in {1..{{ ansible_processor_vcpus }}}; do + echo "`date` - $t Threads`" + curl -s http://localhost:11434/api/generate \ + -d '{"model":"$model","prompt":"Hello","stream":false,"options":{"num_thread":$t}}' \ + | jq .eval_count / .eval_duration + done + } + alias ollama-threads="ollama_threads " + alias ollama-cpus="ollama_threads " + alias ollama-cpu="ollama_threads " state: present create: false backup: true