#!/bin/bash
# GPU health check after hung process
echo "=== GPU processes ==="
lsof /dev/kfd 2>/dev/null | head -10
lsof /dev/dri/renderD128 2>/dev/null | head -10

echo ""
echo "=== dmesg GPU errors (last 50 lines) ==="
dmesg | grep -iE "amdgpu|gfx|gpu|drm|kfd|reset|fault|error|hang" | tail -50

echo ""
echo "=== rocm-smi ==="
rocm-smi 2>&1 | head -20

echo ""
echo "=== Any python processes? ==="
pgrep -la python | head -10

echo ""
echo "=== System uptime ==="
uptime
