#!/bin/bash
source /home/fabian/ComfyUI/venv/bin/activate
export HSA_OVERRIDE_GFX_VERSION=10.1.0
export HSA_ENABLE_SDMA=0
export HIP_VISIBLE_DEVICES=0

python3.11 -c "
import torch
print('PyTorch version:', torch.__version__)
print('HIP version:', torch.version.hip)
print('CUDA available:', torch.cuda.is_available())
if torch.cuda.is_available():
    print('Device name:', torch.cuda.get_device_name(0))
    print('Device count:', torch.cuda.device_count())
    # Quick tensor test
    x = torch.randn(100, 100, device='cuda')
    y = torch.randn(100, 100, device='cuda')
    z = x @ y
    print('GPU matmul test: OK, shape', z.shape)
    print('Memory allocated:', torch.cuda.memory_allocated(0) / 1024 / 1024, 'MB')
else:
    print('NO GPU DETECTED')
"
