1111 cuda-version :
1212 required : true
1313 type : string
14+ prev-cuda-version :
15+ required : true
16+ type : string
1417
1518defaults :
1619 run :
@@ -109,33 +112,6 @@ jobs:
109112 path : cuda_pathfinder/*.whl
110113 if-no-files-found : error
111114
112- - name : Build cuda.core wheel
113- uses : pypa/cibuildwheel@7c619efba910c04005a835b110b057fc28fd6e93 # v3.2.0
114- with :
115- package-dir : ./cuda_core/
116- output-dir : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
117-
118- - name : List the cuda.core artifacts directory
119- run : |
120- if [[ "${{ inputs.host-platform }}" == win* ]]; then
121- export CHOWN=chown
122- else
123- export CHOWN="sudo chown"
124- fi
125- $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
126- ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
127-
128- - name : Check cuda.core wheel
129- run : |
130- twine check --strict ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
131-
132- - name : Upload cuda.core build artifacts
133- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
134- with :
135- name : ${{ env.CUDA_CORE_ARTIFACT_NAME }}
136- path : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
137- if-no-files-found : error
138-
139115 - name : Set up mini CTK
140116 uses : ./.github/actions/fetch_ctk
141117 continue-on-error : false
@@ -148,6 +124,15 @@ jobs:
148124 with :
149125 package-dir : ./cuda_bindings/
150126 output-dir : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
127+ env :
128+ CIBW_BUILD : ${{ env.CIBW_BUILD }}
129+ # CIBW mounts the host filesystem under /host
130+ CIBW_ENVIRONMENT_LINUX : >
131+ CUDA_PATH=/host/${{ env.CUDA_PATH }}
132+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
133+ CIBW_ENVIRONMENT_WINDOWS : >
134+ CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
135+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
151136
152137 - name : List the cuda.bindings artifacts directory
153138 run : |
@@ -170,6 +155,47 @@ jobs:
170155 path : ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}/*.whl
171156 if-no-files-found : error
172157
158+ - name : Build cuda.core wheel
159+ uses : pypa/cibuildwheel@c923d83ad9c1bc00211c5041d0c3f73294ff88f6 # v3.1.4
160+ with :
161+ package-dir : ./cuda_core/
162+ output-dir : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
163+ env :
164+ CIBW_BUILD : ${{ env.CIBW_BUILD }}
165+ # CIBW mounts the host filesystem under /host
166+ CIBW_ENVIRONMENT_LINUX : >
167+ CUDA_PATH=/host/${{ env.CUDA_PATH }}
168+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
169+ CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
170+ PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
171+ CIBW_ENVIRONMENT_WINDOWS : >
172+ CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
173+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
174+ CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
175+ PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
176+
177+ - name : List the cuda.core artifacts directory and rename
178+ run : |
179+ if [[ "${{ inputs.host-platform }}" == win* ]]; then
180+ export CHOWN=chown
181+ else
182+ export CHOWN="sudo chown"
183+ fi
184+ $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
185+
186+ # Rename wheel to include CUDA version suffix
187+ mkdir -p "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_CUDA_MAJOR}"
188+ for wheel in ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl; do
189+ if [[ -f "${wheel}" ]]; then
190+ base_name=$(basename "${wheel}" .whl)
191+ new_name="${base_name}.cu${BUILD_CUDA_MAJOR}.whl"
192+ mv "${wheel}" "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_CUDA_MAJOR}/${new_name}"
193+ echo "Renamed wheel to: ${new_name}"
194+ fi
195+ done
196+
197+ ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
198+
173199 # We only need/want a single pure python wheel, pick linux-64 index 0.
174200 - name : Build and check cuda-python wheel
175201 if : ${{ strategy.job-index == 0 && inputs.host-platform == 'linux-64' }}
@@ -241,7 +267,7 @@ jobs:
241267
242268 - name : Build cuda.core Cython tests
243269 run : |
244- pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl --group ./cuda_core/pyproject.toml:test
270+ pip install ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/"cu${BUILD_CUDA_MAJOR}"/ *.whl --group ./cuda_core/pyproject.toml:test
245271 pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
246272 bash build_tests.sh
247273 popd
@@ -252,3 +278,107 @@ jobs:
252278 name : ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests
253279 path : ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}/test_*${{ env.PY_EXT_SUFFIX }}
254280 if-no-files-found : error
281+
282+ # Note: This overwrites CUDA_PATH etc
283+ - name : Set up mini CTK
284+ uses : ./.github/actions/fetch_ctk
285+ continue-on-error : false
286+ with :
287+ host-platform : ${{ inputs.host-platform }}
288+ cuda-version : ${{ inputs.prev-cuda-version }}
289+ cuda-path : " ./cuda_toolkit_prev"
290+
291+ - name : Download cuda.bindings build artifacts from the prior branch
292+ if : ${{ matrix.python-version == '3.13t'
293+ || matrix.python-version == '3.14'
294+ || matrix.python-version == '3.14t' }}
295+ env :
296+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
297+ run : |
298+ if ! (command -v gh 2>&1 >/dev/null); then
299+ # See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt.
300+ # gh is needed for artifact fetching.
301+ mkdir -p -m 755 /etc/apt/keyrings \
302+ && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
303+ && cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
304+ && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
305+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
306+ && apt update \
307+ && apt install gh -y
308+ fi
309+
310+ OLD_BRANCH=$(cat .github/BACKPORT_BRANCH)
311+ OLD_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}*"
312+ LATEST_PRIOR_RUN_ID=$(gh run list -b ${OLD_BRANCH} -L 1 -w "ci.yml" -s completed -R NVIDIA/cuda-python --json databaseId | jq '.[]| .databaseId')
313+ if [[ "$LATEST_PRIOR_RUN_ID" == "" ]]; then
314+ echo "LATEST_PRIOR_RUN_ID not found!"
315+ exit 1
316+ fi
317+
318+ gh run download $LATEST_PRIOR_RUN_ID -p ${OLD_BASENAME} -R NVIDIA/cuda-python
319+ rm -rf ${OLD_BASENAME}-tests # exclude cython test artifacts
320+ ls -al $OLD_BASENAME
321+ mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
322+ mv $OLD_BASENAME/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
323+ rmdir $OLD_BASENAME
324+
325+ - name : Build cuda.core wheel
326+ uses : pypa/cibuildwheel@c923d83ad9c1bc00211c5041d0c3f73294ff88f6 # v3.1.4
327+ with :
328+ package-dir : ./cuda_core/
329+ output-dir : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
330+ env :
331+ CIBW_BUILD : ${{ env.CIBW_BUILD }}
332+ # CIBW mounts the host filesystem under /host
333+ CIBW_ENVIRONMENT_LINUX : >
334+ CUDA_PATH=/host/${{ env.CUDA_PATH }}
335+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
336+ CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
337+ PIP_FIND_LINKS=/host/${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
338+ CIBW_ENVIRONMENT_WINDOWS : >
339+ CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
340+ CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
341+ CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
342+ PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
343+
344+ - name : List the cuda.core artifacts directory and rename
345+ run : |
346+ if [[ "${{ inputs.host-platform }}" == win* ]]; then
347+ export CHOWN=chown
348+ else
349+ export CHOWN="sudo chown"
350+ fi
351+ $CHOWN -R $(whoami) ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
352+ ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
353+
354+ # Rename wheel to include CUDA version suffix
355+ mkdir -p "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_PREV_CUDA_MAJOR}"
356+ for wheel in ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl; do
357+ if [[ -f "${wheel}" ]]; then
358+ base_name=$(basename "${wheel}" .whl)
359+ new_name="${base_name}.cu${BUILD_PREV_CUDA_MAJOR}.whl"
360+ mv "${wheel}" "${{ env.CUDA_CORE_ARTIFACTS_DIR }}/cu${BUILD_PREV_CUDA_MAJOR}/${new_name}"
361+ echo "Renamed wheel to: ${new_name}"
362+ fi
363+ done
364+
365+ ls -lahR ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
366+
367+ - name : Merge cuda.core wheels
368+ run : |
369+ pip install wheel
370+ python ci/tools/merge_cuda_core_wheels.py \
371+ "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_CUDA_MAJOR}"/cuda_core*.whl \
372+ "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"/cu"${BUILD_PREV_CUDA_MAJOR}"/cuda_core*.whl \
373+ --output-dir "${{ env.CUDA_CORE_ARTIFACTS_DIR }}"
374+
375+ - name : Check cuda.core wheel
376+ run : |
377+ twine check --strict ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
378+
379+ - name : Upload cuda.core build artifacts
380+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
381+ with :
382+ name : ${{ env.CUDA_CORE_ARTIFACT_NAME }}
383+ path : ${{ env.CUDA_CORE_ARTIFACTS_DIR }}/*.whl
384+ if-no-files-found : error
0 commit comments