llm, add function for benchmarking whether more threads adds latency.

This commit is contained in:
me committed 2026-10-21 02:57:12 -07:00
1 parent 4fd12ce45e
commit 5620e5a223
1 file changed
+17
+17
View File
@@ -904,6 +904,23 @@
} }
alias ollama-sizes="ollama_sizes " alias ollama-sizes="ollama_sizes "
alias model-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 state: present
create: false create: false
backup: true backup: true