feat(ollama): add docker swarm configuration for rocm gpu support
Introduce a new compose.yml to deploy Ollama with AMD GPU hardware acceleration on Docker Swarm. - Uses the ROCm-enabled Ollama image. - Mounts necessary GPU devices (/dev/kfd and /dev/dri) with root permissions for hardware access. - Sets HSA_OVERRIDE_GFX_VERSION to 10.3.0 to support Navi 21 (6900 XT) cards. - Configures persistent storage on local SSD and integrates with an external proxy network. - Includes deployment constraints to target nodes labeled with GPUs.
This commit is contained in:
38
Local Homelab/ollama/compose/compose.yml
Normal file
38
Local Homelab/ollama/compose/compose.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
version: '3.8'
|
||||||
|
name: ollama
|
||||||
|
|
||||||
|
services:
|
||||||
|
ollama:
|
||||||
|
image: ollama/ollama:rocm
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.labels.gpu == true
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
|
# We use "host" mode for devices in Swarm to avoid permission headaches
|
||||||
|
# This allows the container to see the /dev/kfd and /dev/dri paths we mount below
|
||||||
|
user: root
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /mnt/local-ssd/docker/ollama:/root/.ollama
|
||||||
|
# Mount the Kernel Fusion Driver (Required for ROCm)
|
||||||
|
- /dev/kfd:/dev/kfd
|
||||||
|
# Mount the Direct Rendering Interface (The actual cards)
|
||||||
|
- /dev/dri:/dev/dri
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
|
||||||
|
environment:
|
||||||
|
# Force support for Navi 21 (6900 XT)
|
||||||
|
- HSA_OVERRIDE_GFX_VERSION=10.3.0
|
||||||
|
# Tell ROCm to verify usage
|
||||||
|
- ROCR_VISIBLE_DEVICES=all
|
||||||
|
- OLLAMA_HOST=0.0.0.0
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
Reference in New Issue
Block a user