Files
Munich-news/scripts/start-with-gpu.sh
2025-11-16 20:59:14 +01:00

47 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Script to start Docker Compose with GPU support if available
echo "Munich News - GPU Detection & Startup"
echo "======================================"
echo ""
# Check if nvidia-smi is available
if command -v nvidia-smi &> /dev/null; then
echo "✓ NVIDIA GPU detected!"
nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader
echo ""
# Check if nvidia-docker runtime is available
if docker run --rm --gpus all nvidia/cuda:12.0.0-base-ubuntu22.04 nvidia-smi &> /dev/null; then
echo "✓ NVIDIA Docker runtime is available"
echo ""
echo "Starting services with GPU support..."
docker compose -f docker-compose.yml -f docker-compose.gpu.yml up -d
echo ""
echo "✓ Services started with GPU acceleration!"
echo ""
echo "To verify GPU is being used by Ollama:"
echo " docker exec munich-news-ollama nvidia-smi"
else
echo "⚠ NVIDIA Docker runtime not found!"
echo ""
echo "To enable GPU support, install nvidia-container-toolkit:"
echo " https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html"
echo ""
echo "Starting services without GPU support..."
docker-compose up -d
fi
else
echo " No NVIDIA GPU detected"
echo "Starting services with CPU-only mode..."
docker-compose up -d
fi
echo ""
echo "Services are starting. Check status with:"
echo " docker-compose ps"
echo ""
echo "View logs:"
echo " docker-compose logs -f ollama"