#!/bin/bash
# GPU Detection Script - Can be called from daemon to detect host GPUs
# This script runs on the host and returns GPU information

# Detect CUDA
if command -v nvidia-smi &> /dev/null; then
    echo "CUDA"
    nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
    exit 0
fi

# Detect ROCm
if command -v rocm-smi &> /dev/null; then
    echo "ROCm"
    rocm-smi --showproductname
    exit 0
fi

# Detect NPU
if lspci 2>/dev/null | grep -i "neural\|vpu" > /dev/null; then
    echo "NPU"
    exit 0
fi

echo "NONE"
exit 1
