Skip to content

Commit e2994f7

Browse files
committed
adds additional cuda arch values to CI matrix
1 parent c632ec7 commit e2994f7

1 file changed

Lines changed: 55 additions & 18 deletions

File tree

.github/workflows/test.yml

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,28 @@ jobs:
106106
path: dist/
107107

108108
cuda:
109-
name: CUDA ${{ matrix.cuda }} / ${{ matrix.arch }}
109+
name: CUDA ${{ matrix.cuda_path }}
110110
# Pinned rather than ubuntu-latest: NVIDIA's apt repository path is
111111
# distro-version specific.
112112
runs-on: ubuntu-24.04
113113
strategy:
114114
fail-fast: false
115115
matrix:
116116
include:
117-
# CUDA 12 still supports Volta, which is pyJac's default target.
118117
- cuda: '12-6'
119118
cuda_path: '12.6'
120-
arch: sm_70
121-
# CUDA 13 dropped Maxwell, Pascal and Volta, so the oldest it accepts
122-
# is Turing. This entry is what tells us whether the default needs to
123-
# move.
119+
# Volta is pyJac's current default and CUDA 12 still accepts it.
120+
required_archs: sm_70 sm_75 sm_80 sm_90
121+
optional_archs: sm_50 sm_60
124122
- cuda: '13-3'
125123
cuda_path: '13.3'
126-
arch: sm_75
124+
required_archs: sm_75 sm_80 sm_90
125+
# sm_70 is here to settle whether pyJac's default still builds on
126+
# a current toolkit: CUDA 13.0 removed offline compilation support
127+
# for Maxwell, Pascal and Volta, and offline is exactly what this
128+
# job does. The Blackwell-and-later targets are probes -- nvcc
129+
# reports what it really supports in the step below.
130+
optional_archs: sm_70 sm_100 sm_103 sm_120 sm_121 sm_130
127131

128132
steps:
129133
- uses: actions/checkout@v4
@@ -134,7 +138,7 @@ jobs:
134138

135139
# Installed from NVIDIA's own apt repository rather than a third-party
136140
# action, and only the compiler: the full toolkit is several GB.
137-
- name: Install nvcc ${{ matrix.cuda }}
141+
- name: Install nvcc ${{ matrix.cuda_path }}
138142
run: |
139143
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
140144
sudo dpkg -i cuda-keyring_1.1-1_all.deb
@@ -145,19 +149,52 @@ jobs:
145149
- name: Install
146150
run: python -m pip install --upgrade pip && pip install -e '.[test]'
147151

152+
# Authoritative, rather than a list we would have to maintain by hand.
153+
- name: Report what this toolkit supports
154+
run: |
155+
nvcc --version
156+
echo '--- architectures nvcc can target ---'
157+
nvcc --list-gpu-arch
158+
148159
# There is no GPU on the runner, so the generated CUDA is compiled but
149160
# never executed. This catches syntax and API errors, not wrong numbers.
150-
# It goes through pyjac.libgen rather than a hand-rolled nvcc loop, so
151-
# the build machinery and the --cuda-arch plumbing are exercised too.
161+
# The build goes through pyjac.libgen rather than a hand-rolled nvcc
162+
# loop, so the build machinery and --cuda-arch plumbing are exercised.
152163
- name: Generate CUDA sources
153164
run: python -m pyjac --lang cuda --input data/h2o2.inp --build_path out-cuda
154165

155-
- name: Build the CUDA library
166+
- name: Build for each architecture
156167
run: |
157-
nvcc --version
158-
python -m pyjac.libgen --lang cuda --source_dir out-cuda \
159-
--out_dir lib-cuda --obj_dir obj-cuda \
160-
--static --cuda-arch ${{ matrix.arch }}
161-
162-
- name: Confirm the library was produced
163-
run: test -f lib-cuda/libcu_pyjac.a && ls -l lib-cuda/
168+
summary=""
169+
status=0
170+
for arch in ${{ matrix.required_archs }} ${{ matrix.optional_archs }}; do
171+
case " ${{ matrix.required_archs }} " in
172+
*" $arch "*) kind=required ;;
173+
*) kind=optional ;;
174+
esac
175+
176+
rm -rf lib-cuda obj-cuda
177+
if python -m pyjac.libgen --lang cuda --source_dir out-cuda \
178+
--out_dir lib-cuda --obj_dir obj-cuda \
179+
--static --cuda-arch "$arch" > "build-$arch.log" 2>&1 \
180+
&& test -f lib-cuda/libcu_pyjac.a; then
181+
summary="$summary\n| $arch | $kind | built |"
182+
else
183+
summary="$summary\n| $arch | $kind | FAILED |"
184+
echo "::group::$arch ($kind) failed"
185+
tail -25 "build-$arch.log"
186+
echo "::endgroup::"
187+
if [ "$kind" = required ]; then status=1; fi
188+
fi
189+
done
190+
191+
{
192+
echo "### CUDA ${{ matrix.cuda_path }}"
193+
echo
194+
echo "| arch | kind | result |"
195+
echo "| --- | --- | --- |"
196+
printf "%b\n" "$summary"
197+
} >> "$GITHUB_STEP_SUMMARY"
198+
199+
printf "%b\n" "$summary"
200+
exit $status

0 commit comments

Comments
 (0)