Skip to content

Commit 291e527

Browse files
committed
Use AMD's container
1 parent b6554f1 commit 291e527

1 file changed

Lines changed: 23 additions & 40 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,17 @@ jobs:
487487
488488
ubuntu-latest-rocm:
489489
runs-on: ubuntu-latest
490+
container: rocm/dev-ubuntu-24.04:7.2
490491

491492
env:
492493
ROCM_VERSION: "7.2"
493494
GPU_TARGETS: "gfx1151;gfx1150;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
494495

495496
steps:
497+
- run: apt-get update && apt-get install -y git
496498
- name: Clone
497499
id: checkout
498-
uses: actions/checkout@v3
500+
uses: actions/checkout@v6
499501
with:
500502
submodules: recursive
501503

@@ -512,45 +514,16 @@ jobs:
512514
sudo rm -rf /var/lib/apt/lists/* || true
513515
sudo apt clean
514516
515-
- name: Setup ROCm Repository
516-
run: |
517-
# Always setup ROCm repository (needed even when cache hits)
518-
sudo apt update
519-
sudo apt install -y wget gnupg2
520-
521-
# Add ROCm repository using modern GPG key handling
522-
wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-archive-keyring.gpg
523-
echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/${{ env.ROCM_VERSION }}/ noble main" | sudo tee /etc/apt/sources.list.d/rocm.list
524-
525-
# Set ROCm repository to highest priority to avoid conflicts with Ubuntu packages
526-
echo "Package: *" | sudo tee /etc/apt/preferences.d/rocm-pin
527-
echo "Pin: origin repo.radeon.com" | sudo tee -a /etc/apt/preferences.d/rocm-pin
528-
echo "Pin-Priority: 1001" | sudo tee -a /etc/apt/preferences.d/rocm-pin
529-
530-
sudo apt update
531-
532-
- name: Install ROCm
517+
- name: Dependencies
518+
id: depends
533519
run: |
534-
# Check if ROCm packages are available
535-
echo "Checking ROCm package availability..."
536-
apt-cache show rocm-dev hip-dev hipblas-dev || {
537-
echo "ROCm packages not found, listing available packages:"
538-
apt-cache search rocm | head -10
539-
apt-cache search hip | head -10
540-
}
541-
542-
# Check repository priorities
543-
echo "Checking repository priorities..."
544-
apt-cache policy hipcc rocm-cmake rocm-utils
545-
546-
# Install ROCm packages (APT preferences will ensure ROCm repo versions are used)
547-
echo "Installing ROCm packages..."
520+
sudo apt-get update
548521
sudo apt install -y \
549522
rocm-dev \
550523
hip-dev \
551524
hipblas-dev \
525+
cmake \
552526
ninja-build
553-
554527
# Clean apt caches to recover disk space
555528
sudo apt clean
556529
sudo rm -rf /var/lib/apt/lists/* || true
@@ -560,21 +533,31 @@ jobs:
560533
# Add ROCm to PATH for current session
561534
echo "/opt/rocm/bin" >> $GITHUB_PATH
562535
536+
# Build case pattern from GPU_TARGETS
537+
PATTERN=$(printf '%s' "$GPU_TARGETS" | sed 's/;/\*|\*/g')
538+
PATTERN="*${PATTERN}*"
539+
563540
# Remove library files for architectures we're not building for to save disk space
564541
echo "Cleaning up unneeded architecture files..."
565542
cd /opt/rocm/lib/rocblas/library
566543
# Keep only our target architectures
567544
for file in *; do
568-
if [[ ! "$file" =~ (gfx1151|gfx1150|gfx1100|gfx1101|gfx1102|gfx1200|gfx1201) ]]; then
569-
sudo rm -f "$file"
570-
fi
545+
case "$file" in
546+
$PATTERN)
547+
;;
548+
*)
549+
sudo rm -f "$file" ;;
550+
esac;
571551
done
572552
573553
cd /opt/rocm/lib/hipblaslt/library
574554
for file in *; do
575-
if [[ ! "$file" =~ (gfx1151|gfx1150|gfx1100|gfx1101|gfx1102|gfx1200|gfx1201) ]]; then
576-
sudo rm -f "$file"
577-
fi
555+
case "$file" in
556+
$PATTERN)
557+
;;
558+
*)
559+
sudo rm -f "$file" ;;
560+
esac;
578561
done
579562
580563
- name: Build

0 commit comments

Comments
 (0)