#!/bin/bash # Test AMD GPU setup for Docker Model Runner echo "=== AMD GPU Setup Test ===" echo "" # Check if AMD GPU devices are available echo "Checking AMD GPU devices..." if [[ -e /dev/kfd ]]; then echo "✅ /dev/kfd (AMD GPU compute) is available" else echo "❌ /dev/kfd not found - AMD GPU compute not available" fi if [[ -e /dev/dri/renderD128 ]] || [[ -e /dev/dri/card0 ]]; then echo "✅ /dev/dri (AMD GPU graphics) is available" else echo "❌ /dev/dri not found - AMD GPU graphics not available" fi echo "" echo "Checking user groups..." if groups | grep -q video; then echo "✅ User is in 'video' group for GPU access" else echo "⚠️ User is not in 'video' group - may need: sudo usermod -aG video $USER" fi echo "" echo "Testing Docker with AMD GPU..." # Test if docker can access AMD GPU devices if docker run --rm --device /dev/kfd:/dev/kfd --device /dev/dri:/dev/dri alpine ls /dev/kfd /dev/dri 2>/dev/null | grep -q kfd; then echo "✅ Docker can access AMD GPU devices" else echo "❌ Docker cannot access AMD GPU devices" echo " Try: sudo chmod 666 /dev/kfd /dev/dri/*" fi echo "" echo "=== Environment Variables ===" echo "DISPLAY: $DISPLAY" echo "USER: $USER" echo "HSA_OVERRIDE_GFX_VERSION: ${HSA_OVERRIDE_GFX_VERSION:-not set}" echo "" echo "=== Next Steps ===" echo "If tests failed, try:" echo "1. sudo usermod -aG video $USER" echo "2. sudo chmod 666 /dev/kfd /dev/dri/*" echo "3. Reboot or logout/login" echo "" echo "Then start the model runner:" echo "docker-compose up -d docker-model-runner" echo "" echo "Test API access:" echo "curl http://localhost:11434/api/tags" echo "curl http://localhost:8083/api/tags"