#!/bin/bash
# =============================================================================
# Step 1: Install ROCm 7.2.0 Packages — AMD BC-250
# =============================================================================
# Install all 16 required ROCm packages from CachyOS/Arch repos.
# Run as: sudo bash 01_install_rocm_packages.sh
# =============================================================================

set -euo pipefail

echo "============================================"
echo " Installing ROCm 7.2.0 Packages for BC-250"
echo "============================================"

# Ensure pacman is up to date
sudo pacman -Sy

# Install all 16 ROCm packages
sudo pacman -S --needed --noconfirm \
    rocm-core \
    rocm-hip-runtime \
    rocm-hip-sdk \
    rocm-opencl-runtime \
    rocm-opencl-sdk \
    hip-runtime-amd \
    rocm-clang-ocl \
    rocm-device-libs \
    rocminfo \
    rocm-smi-lib \
    hsa-rocr \
    hsakmt-roct \
    comgr \
    hipcc \
    rocprofiler-register \
    rocm-llvm

echo ""
echo "============================================"
echo " ROCm packages installed successfully"
echo "============================================"

# Verify installation
echo ""
echo "Installed ROCm packages:"
pacman -Q | grep -E "rocm|hip-|hsa|comgr|hipcc" | sort

echo ""
echo "Next: Run 02_configure_environment.sh"
