|
| 1 | +[Unit] |
| 2 | +Description='MiOS' Ollama (iGPU instance, micro-LLM lane via AMD ROCm) |
| 3 | +After=network-online.target mios-cdi-detect.service |
| 4 | +Wants=network-online.target |
| 5 | +# Operator directive 2026-05-18: "iGPU model(s) isn't working" -- |
| 6 | +# diagnosis: ollama/ollama:latest is the CUDA-only image; even with |
| 7 | +# the AMD CDI device (wsl2-amd.yaml) wired in via the |
| 8 | +# /etc/containers/systemd/ollama.container.d/20-mios-igpu.conf |
| 9 | +# drop-in, ollama-CUDA can't actually compute on the AMD iGPU. The |
| 10 | +# fix is a SECOND ollama instance using ollama/ollama:rocm pinned to |
| 11 | +# the AMD device. The original mios-ollama keeps the dGPU + CUDA; |
| 12 | +# this instance gets the iGPU + ROCm. Sibling, not replacement. |
| 13 | +# |
| 14 | +# Operator directive 2026-05-17 (still in force): "iGPU's are ONLY |
| 15 | +# micro-llms" + "wire to ollama!! JUST ONLY USES Micro-llms in MiOS |
| 16 | +# stack". This Quadlet hosts only the small models (qwen3:1.7b, |
| 17 | +# qwen3:0.6b, etc.) -- mios-daemon + agent-pipe router + (future) |
| 18 | +# refine all point at :11435 for the micro-LLM lane. Big-model |
| 19 | +# inference stays on the dGPU/CUDA mios-ollama at :11434. |
| 20 | + |
| 21 | +[Container] |
| 22 | +# ROCm variant -- only image that can compute on AMD GPUs. Pinned |
| 23 | +# from mios.toml [image.sidecars].ollama_igpu (rendered at build). |
| 24 | +Image=${MIOS_OLLAMA_IGPU_IMAGE:-docker.io/ollama/ollama:rocm} |
| 25 | +ContainerName=mios-ollama-igpu |
| 26 | +# Host networking -- same workaround as mios-surrealdb. Dual-bridge |
| 27 | +# (mios.network + ai-net.network) + PublishPort hits a podman-WSL |
| 28 | +# port-forwarder quirk where the host listener never binds even |
| 29 | +# though `podman port` reports the mapping. Host-net gives the iGPU |
| 30 | +# instance a reliable http://localhost:11435 for mios-daemon + |
| 31 | +# agent-pipe router; no isolation loss that matters at loopback. |
| 32 | +Network=host |
| 33 | +AutoUpdate=registry |
| 34 | + |
| 35 | +# AMD-only device pinning. Crucially does NOT add nvidia.com/gpu -- |
| 36 | +# this instance must stay off the dGPU so the dGPU/CUDA mios-ollama |
| 37 | +# can keep using it for big models without contention. The amd.com/ |
| 38 | +# gpu CDI spec is the WSL2 hand-rolled wsl2-amd.yaml that |
| 39 | +# mios-cdi-detect.service writes to /run/cdi/ at boot. |
| 40 | +AddDevice=amd.com/gpu=all |
| 41 | + |
| 42 | +# Identity: mios-ollama-igpu (uid 823) -- sibling sysuser to |
| 43 | +# mios-ollama (uid 815). Separate UID so the iGPU instance's data |
| 44 | +# dir ownership doesn't collide with the CUDA instance even on |
| 45 | +# hosts that share /var/lib/ollama/models. |
| 46 | +User=${MIOS_OLLAMA_IGPU_UID:-823} |
| 47 | +Group=${MIOS_OLLAMA_IGPU_GID:-823} |
| 48 | + |
| 49 | +# Distinct port -- mios-daemon's MIOS_DAEMON_ENDPOINT and the |
| 50 | +# agent-pipe router's MIOS_AGENT_PIPE_ROUTER_ENDPOINT point at |
| 51 | +# :11435 for the micro-LLM lane. The CUDA mios-ollama keeps :11434. |
| 52 | +Environment=OLLAMA_HOST=0.0.0.0:${MIOS_PORT_OLLAMA_IGPU:-11435} |
| 53 | +Environment=OLLAMA_ORIGINS=* |
| 54 | + |
| 55 | +# Share the model store with mios-ollama -- the build-baked seed at |
| 56 | +# /usr/share/ollama/models was hardlinked into /var/lib/ollama/models |
| 57 | +# on first boot, and the iGPU instance reuses the same blobs. Saves |
| 58 | +# disk + means a model pulled via either instance is immediately |
| 59 | +# visible to the other. |
| 60 | +Environment=OLLAMA_MODELS=/var/lib/ollama/models |
| 61 | +Environment=HOME=/var/lib/ollama-igpu |
| 62 | + |
| 63 | +# Micro-LLM lane parallelism. Smaller models, smaller per-request |
| 64 | +# memory footprint -- can run more concurrent slots than the CUDA |
| 65 | +# instance. mios-daemon's classify + refusal + cron loops all hit |
| 66 | +# this lane; agent-pipe's router classifier hits it; future kanban- |
| 67 | +# auto-dispatched parallel CPU agents will saturate it. |
| 68 | +Environment=OLLAMA_NUM_PARALLEL=8 |
| 69 | +Environment=OLLAMA_MAX_LOADED_MODELS=6 |
| 70 | + |
| 71 | +# Volumes: |
| 72 | +# /var/lib/ollama shared writable model store (read-write |
| 73 | +# so the iGPU instance can ALSO pull |
| 74 | +# models if asked; the small-model set |
| 75 | +# rarely changes day-to-day) |
| 76 | +# /var/lib/ollama-igpu iGPU-only HOME + ssh-key state |
| 77 | +# /usr/share/ollama immutable seed mounted RO |
| 78 | +Volume=/var/lib/ollama:/var/lib/ollama:Z |
| 79 | +Volume=/var/lib/ollama-igpu:/var/lib/ollama-igpu:Z |
| 80 | +Volume=/usr/share/ollama:/usr/share/ollama:ro,Z |
| 81 | + |
| 82 | +# Host networking -- no PublishPort needed; the OLLAMA_HOST bind |
| 83 | +# above (0.0.0.0:${MIOS_PORT_OLLAMA_IGPU}) goes directly to the |
| 84 | +# host loopback + LAN interfaces. |
| 85 | + |
| 86 | +Label=org.opencontainers.image.title=mios-ollama-igpu |
| 87 | +Label=org.opencontainers.image.url=http://localhost:11435/ |
| 88 | +Label=io.podman_desktop.openInBrowser=http://localhost:11435/ |
| 89 | + |
| 90 | +[Service] |
| 91 | +Restart=on-failure |
| 92 | +RestartSec=10 |
| 93 | +Delegate=yes |
| 94 | + |
| 95 | +[Install] |
| 96 | +WantedBy=multi-user.target default.target |
0 commit comments