Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

Commit e141696

Browse files
authored
Enhance CMake workflow for CUDA and HIP builds
Updated CMake workflow for CUDA and HIP builds. Increased timeout for CUDA jobs and modified detection logic for HIP and CUDA backends.
1 parent 44e2b2e commit e141696

1 file changed

Lines changed: 47 additions & 59 deletions

File tree

.github/workflows/cmake-build_cuda_hip.yml

Lines changed: 47 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ env:
1515
jobs:
1616
detect:
1717
runs-on: ubuntu-24.04
18+
timeout-minutes: 10
1819
outputs:
1920
has_hip: ${{ steps.detect.outputs.has_hip }}
2021
has_cuda_backend: ${{ steps.detect.outputs.has_cuda_backend }}
2122
steps:
2223
- uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
2326

2427
- id: detect
2528
shell: bash
@@ -29,11 +32,11 @@ jobs:
2932
has_hip=false
3033
has_cuda_backend=false
3134
32-
if grep -R -n -E 'DEME_GPU_BACKEND|USE_HIP|LANGUAGES[[:space:]]+.*HIP|CMAKE_HIP_ARCHITECTURES|find_package\(.*HIP|project\(.*HIP|hipcc|ROCM_PATH|DEME_ROCM_ROOT' CMakeLists.txt cmake src >/dev/null 2>&1; then
35+
if grep -R -n -E 'DEME_GPU_BACKEND|USE_HIP|LANGUAGES[[:space:]]+.*HIP|CMAKE_HIP_ARCHITECTURES|find_package\(.*HIP|project\(.*HIP|hipcc|ROCM_PATH|DEME_ROCM_ROOT|DEME_HIP_ARCH' CMakeLists.txt cmake src >/dev/null 2>&1; then
3336
has_hip=true
3437
fi
3538
36-
if grep -R -n -E 'LANGUAGES[[:space:]]+.*CUDA|enable_language\(CUDA\)|find_package\(CUDAToolkit|CMAKE_CUDA_ARCHITECTURES|CUDA_ARCHITECTURES|nvcc|find_package\(.*CUB' CMakeLists.txt cmake src >/dev/null 2>&1; then
39+
if grep -R -n -E 'LANGUAGES[[:space:]]+.*CUDA|enable_language\(CUDA\)|find_package\(CUDAToolkit|CMAKE_CUDA_ARCHITECTURES|CUDA_ARCHITECTURES|nvcc|find_package\(.*CUB|jitify' CMakeLists.txt cmake src .gitmodules >/dev/null 2>&1; then
3740
has_cuda_backend=true
3841
fi
3942
@@ -45,9 +48,10 @@ jobs:
4548
needs: detect
4649
if: needs.detect.outputs.has_cuda_backend == 'true'
4750
runs-on: ubuntu-24.04
48-
timeout-minutes: 45
51+
timeout-minutes: 60
4952
strategy:
5053
fail-fast: false
54+
max-parallel: 2
5155
matrix:
5256
include:
5357
- cuda: '12.8.1'
@@ -59,40 +63,33 @@ jobs:
5963
image: ${{ matrix.image }}
6064

6165
steps:
62-
- uses: actions/checkout@v4
63-
64-
- name: Install build tools
66+
- name: Install tools
6567
shell: bash
6668
run: |
6769
set -euo pipefail
6870
apt-get update
69-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
70-
build-essential \
71-
cmake \
72-
ninja-build \
73-
git \
74-
pkg-config
75-
76-
- name: Show toolchain
71+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential ca-certificates cmake git ninja-build pkg-config
72+
73+
- uses: actions/checkout@v4
74+
with:
75+
submodules: recursive
76+
77+
- name: Preflight
7778
shell: bash
7879
run: |
7980
set -euo pipefail
8081
nvcc --version
8182
cmake --version
82-
ls -ld /usr/local/cuda
83-
ls -ld /usr/local/cuda/lib64/cmake || true
84-
ls -ld /usr/local/cuda/lib64/cmake/cub || true
83+
test -f /usr/local/cuda/lib64/cmake/cub/cub-config.cmake
84+
test -f /usr/local/cuda/lib64/cmake/libcudacxx/libcudacxx-config.cmake
85+
test -f /usr/local/cuda/lib64/cmake/thrust/thrust-config.cmake
86+
test -f thirdparty/jitify/jitify.hpp
8587
8688
- name: Configure
8789
shell: bash
8890
run: |
8991
set -euo pipefail
90-
cmake -S . -B build \
91-
-G Ninja \
92-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
93-
-DDEME_GPU_BACKEND=CUDA \
94-
-DCUDAToolkit_ROOT=/usr/local/cuda \
95-
-DCUB_DIR=/usr/local/cuda/lib64/cmake/cub
92+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDEME_GPU_BACKEND=CUDA -DCUDAToolkit_ROOT=/usr/local/cuda -DCMAKE_PREFIX_PATH="/usr/local/cuda;/usr/local/cuda/lib64/cmake;/usr/local/cuda/targets/x86_64-linux" -DCUB_DIR=/usr/local/cuda/lib64/cmake/cub -Dlibcudacxx_DIR=/usr/local/cuda/lib64/cmake/libcudacxx -DThrust_DIR=/usr/local/cuda/lib64/cmake/thrust
9693
9794
- name: Build
9895
shell: bash
@@ -105,89 +102,80 @@ jobs:
105102
needs: detect
106103
if: needs.detect.outputs.has_hip == 'true'
107104
runs-on: ubuntu-24.04
108-
timeout-minutes: 45
105+
timeout-minutes: 60
109106
strategy:
110107
fail-fast: false
108+
max-parallel: 3
111109
matrix:
112110
include:
111+
# CDNA / HPC
113112
- rocm: '7.2'
114-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
113+
image: 'rocm/dev-ubuntu-24.04:7.2'
115114
arch: 'gfx90a'
116115
- rocm: '7.2'
117-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
116+
image: 'rocm/dev-ubuntu-24.04:7.2'
118117
arch: 'gfx942'
119118
- rocm: '7.2.1'
120-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
119+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
121120
arch: 'gfx90a'
122121
- rocm: '7.2.1'
123-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
122+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
124123
arch: 'gfx942'
124+
125+
# RDNA3 / newer Radeon
125126
- rocm: '7.2'
126-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
127+
image: 'rocm/dev-ubuntu-24.04:7.2'
127128
arch: 'gfx1100'
128129
- rocm: '7.2'
129-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
130+
image: 'rocm/dev-ubuntu-24.04:7.2'
130131
arch: 'gfx1101'
131132
- rocm: '7.2'
132-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
133+
image: 'rocm/dev-ubuntu-24.04:7.2'
133134
arch: 'gfx1102'
134135
- rocm: '7.2'
135-
image: 'rocm/dev-ubuntu-24.04:7.2-complete'
136+
image: 'rocm/dev-ubuntu-24.04:7.2'
136137
arch: 'gfx1151'
137138
- rocm: '7.2.1'
138-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
139+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
139140
arch: 'gfx1100'
140141
- rocm: '7.2.1'
141-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
142+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
142143
arch: 'gfx1101'
143144
- rocm: '7.2.1'
144-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
145+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
145146
arch: 'gfx1102'
146147
- rocm: '7.2.1'
147-
image: 'rocm/dev-ubuntu-24.04:7.2.1-complete'
148+
image: 'rocm/dev-ubuntu-24.04:7.2.1'
148149
arch: 'gfx1151'
149150

150151
container:
151152
image: ${{ matrix.image }}
152153

153154
steps:
154-
- uses: actions/checkout@v4
155-
156-
- name: Install build tools
155+
- name: Install tools
157156
shell: bash
158157
run: |
159158
set -euo pipefail
160159
apt-get update
161-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
162-
build-essential \
163-
cmake \
164-
ninja-build \
165-
git \
166-
pkg-config
167-
168-
- name: Show toolchain
160+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential ca-certificates cmake git ninja-build pkg-config
161+
162+
- uses: actions/checkout@v4
163+
with:
164+
submodules: recursive
165+
166+
- name: Preflight
169167
shell: bash
170168
run: |
171169
set -euo pipefail
172170
/opt/rocm/bin/hipcc --version || hipcc --version
173171
cmake --version
174-
ls -ld /opt/rocm
175-
ls -ld /opt/rocm/include
176-
ls -l /opt/rocm/include/hip/hip_runtime.h
172+
test -f /opt/rocm/include/hip/hip_runtime.h
177173
178174
- name: Configure
179175
shell: bash
180176
run: |
181177
set -euo pipefail
182-
cmake -S . -B build \
183-
-G Ninja \
184-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
185-
-DDEME_GPU_BACKEND=HIP \
186-
-DDEME_ROCM_ROOT=/opt/rocm \
187-
-DROCM_PATH=/opt/rocm \
188-
-DDEME_HIP_ARCH=${{ matrix.arch }} \
189-
-DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm \
190-
-DCMAKE_HIP_PLATFORM=amd
178+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDEME_GPU_BACKEND=HIP -DDEME_ROCM_ROOT=/opt/rocm -DROCM_PATH=/opt/rocm -DDEME_HIP_ARCH=${{ matrix.arch }} -DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm -DCMAKE_HIP_PLATFORM=amd
191179
192180
- name: Build
193181
shell: bash

0 commit comments

Comments
 (0)