Skip to content

Ollama (GPU hosts)

Both Ollama servers are community-scripts Ollama LXCs, managed by ansible-playbook playbooks/ollama.yml (role ollama_server, also part of site.yml). Only hosts with ollama_gpu in host_vars are touched.

Host Where GPUs ollama_gpu CT size
ollama-amd-64gb CT 100 on node02, 10.0.3.206:11434 2× Radeon Pro V620 (gfx1030), 60 GiB rocm 64 GB RAM, 8 GB swap, 120 GB rootfs
ollama-nvidia-20gb CT 100 on node01, 10.0.3.177:11434 RTX 3080 20 GB + Quadro RTX 4000 8 GB, 27 GiB cuda 48 GB RAM, 8 GB swap, 200 GB rootfs

Measured on 2026-11-28 with qwen3-coder:30b: 97 tok/s on the V620s, 104 tok/s on the NVIDIA host (split 16 GB / 6 GB over the 3080 and the RTX 4000), both 100% GPU.

What the role does on every Ollama GPU host

Piece Purpose
Container size pct set / pct resize on the Proxmox node from ollama_ct_memory_mb, ollama_ct_swap_mb, ollama_ct_rootfs_gb. Memory applies live; the rootfs only ever grows. Models that do not fit in VRAM are loaded into this RAM — 20 GB was too small for two 30B models.
ollama.service.d/10-infra.conf Replaces the service environment: drops the Intel/SYCL variables of the community-scripts unit (OLLAMA_INTEL_GPU, SYCL_*, ZES_*) and sets OLLAMA_HOST, OLLAMA_CONTEXT_LENGTH=32768. Extra variables per host: ollama_environment_extra.
GPU check After a (re)start the play fails unless Ollama's own log of the current service run shows ollama_expected_gpus GPUs with library=ROCm / library=CUDA.

Why OLLAMA_CONTEXT_LENGTH=32768: with ≥ 48 GiB VRAM Ollama defaults to a 256k context. One qwen3-coder:30b then takes ~53 GB of VRAM and loads in 47 s; with 32k it is ~22 GB, so two 30B models fit. Clients can still ask for a longer context with num_ctx. (The NVIDIA host already defaulted to 32k because it has less VRAM.)

AMD only: keeping the ROCm backend

The community-scripts installer and update-apps install the plain ollama-linux-amd64 tarball. That has CPU and CUDA backends only. Without lib/ollama/rocm_* Ollama does not fail: it silently runs on the CPU. On 2026-11-28 that made 30B models slow (33 instead of 97 tok/s), and loading a second 30B model into the 20 GB container RAM hung node02.

Piece Purpose
/usr/local/sbin/ollama-rocm-ensure Reads ollama -v, downloads ollama-linux-amd64-rocm.tar.zst for exactly that version from the Ollama GitHub release and unpacks it into /usr/local/lib/ollama. Marker: /usr/local/lib/ollama/.rocm-version. Refuses with less than 4 GB free.
ExecStartPre=-ollama-rocm-ensure In the drop-in: every start (also the restart after an update) heals itself. The - means a failed download never blocks startup.
ollama-rocm-ensure.timer 05:15 daily (after update-apps at 04:30): installs when missing and restarts Ollama.
ollama_rocm.prom ollama_rocm_backend_ok{version} and the last run time for node_exporter.

Alerts

OllamaRocmBackendMissing, OllamaRocmEnsureNotRunning (AMD) and OllamaModelOnCpu (both hosts, from the ollama_model_loaded_size_bytes metric of the Ollama collector).

When it runs on the CPU again

pct enter 100
ollama ps                                    # PROCESSOR column: want 100% GPU
journalctl -u ollama -b | grep 'inference compute'   # want library=ROCm / library=CUDA, one line per GPU
# AMD:
ollama-rocm-ensure --check; echo $?          # 0 = ROCm backend present for this Ollama version
ollama-rocm-ensure --restart                 # install + restart
# NVIDIA: nvidia-smi on the node, and check the /dev/nvidia* entries in `pct config 100`

Then re-run playbooks/ollama.yml (Semaphore template ollama). If the AMD download fails because the release has no ROCm archive (layout changed), the script says so in journalctl -u ollama-rocm-ensure.