Skip to content

Commit bea1ad1

Browse files
committed
Merge commit '942204f79001549e5bd91da9cb154795c31e9e2b' into ctk-13.4-prerelease
2 parents 115b9e0 + 942204f commit bea1ad1

8 files changed

Lines changed: 286 additions & 59 deletions

File tree

‎.github/actions/fetch_ctk/action.yml‎

Lines changed: 112 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
required: true
1212
cuda-version:
1313
required: true
14+
cuda-channel:
15+
description: "CUDA package channel: stable redistributables or prerelease packages"
16+
required: false
17+
default: "stable"
1418
cuda-components:
1519
description: "A list of the CTK components to install as a comma-separated list. e.g. 'cuda_nvcc,cuda_nvrtc,cuda_cudart'"
1620
required: false
@@ -30,17 +34,34 @@ runs:
3034
# Use the runtime workspace mount so this also works inside container jobs.
3135
CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
3236
CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }}
33-
CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json"
34-
CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \
35-
--host-platform "${{ inputs.host-platform }}" \
36-
--cuda-version "${{ inputs.cuda-version }}" \
37-
--components "$CTK_CACHE_COMPONENTS" \
38-
--metadata-url "$CTK_JSON_URL")"
37+
CTK_PREVIEW_PACKAGES=
38+
if [[ "${{ inputs.cuda-channel }}" == "stable" ]]; then
39+
CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json"
40+
CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \
41+
--host-platform "${{ inputs.host-platform }}" \
42+
--cuda-version "${{ inputs.cuda-version }}" \
43+
--components "$CTK_CACHE_COMPONENTS" \
44+
--metadata-url "$CTK_JSON_URL")"
45+
elif [[ "${{ inputs.cuda-channel }}" == "prerelease" ]]; then
46+
CTK_PREVIEW_PACKAGES="$(python "$CTK_REDIST_TOOL" preview-packages \
47+
--host-platform "${{ inputs.host-platform }}" \
48+
--cuda-version "${{ inputs.cuda-version }}" \
49+
--components "$CTK_CACHE_COMPONENTS")"
50+
CTK_CACHE_COMPONENTS="$CTK_PREVIEW_PACKAGES"
51+
else
52+
echo "Unsupported CUDA package channel: ${{ inputs.cuda-channel }}" >&2
53+
exit 1
54+
fi
3955
4056
HASH=$(echo -n "${CTK_CACHE_COMPONENTS}" | sha256sum | awk '{print $1}')
41-
echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV
57+
CHANNEL_CACHE_SEGMENT=
58+
if [[ "${{ inputs.cuda-channel }}" != "stable" ]]; then
59+
CHANNEL_CACHE_SEGMENT="-${{ inputs.cuda-channel }}"
60+
fi
61+
echo "CTK_CACHE_KEY=mini-ctk${CHANNEL_CACHE_SEGMENT}-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV
4262
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH.tar.gz" >> $GITHUB_ENV
4363
echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}" >> $GITHUB_ENV
64+
echo "CTK_PREVIEW_PACKAGES=${CTK_PREVIEW_PACKAGES}" >> $GITHUB_ENV
4465
4566
- name: Install dependencies
4667
uses: ./.github/actions/install_unix_deps
@@ -68,48 +89,92 @@ runs:
6889
rm -rf $CACHE_TMP_DIR
6990
mkdir $CACHE_TMP_DIR
7091
71-
# The binary archives (redist) are guaranteed to be updated as part of the release posting.
72-
# Use the runtime workspace mount so this also works inside container jobs.
73-
CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
74-
CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
75-
CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json"
76-
CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json"
77-
curl -LSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE"
78-
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
79-
function extract() {
80-
tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1
81-
}
82-
elif [[ "${{ inputs.host-platform }}" == "win-64" ]]; then
83-
function extract() {
84-
_TEMP_DIR_=$(mktemp -d)
85-
unzip $1 -d $_TEMP_DIR_
86-
cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR
87-
rm -rf $_TEMP_DIR_
88-
# see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5
89-
chmod 644 $CACHE_TMP_DIR/LICENSE
92+
if [[ "${{ inputs.cuda-channel }}" == "prerelease" ]]; then
93+
if [[ "${{ inputs.host-platform }}" != linux* ]]; then
94+
echo "CUDA prerelease package extraction currently supports Linux only" >&2
95+
exit 1
96+
fi
97+
98+
source /etc/os-release
99+
DISTRO_CODENAME="${VERSION_CODENAME:-}"
100+
case "$DISTRO_CODENAME" in
101+
bookworm|jammy|noble|resolute|trixie) ;;
102+
*)
103+
echo "Unsupported distribution for CUDA prerelease packages: ${DISTRO_CODENAME:-unknown}" >&2
104+
exit 1
105+
;;
106+
esac
107+
108+
KEYRING_DEB="$CACHE_TMP_DIR/nvidia-preview-keyring.deb"
109+
curl -fLSs "https://packages.nvidia.com/${DISTRO_CODENAME}/nvidia-preview-keyring.deb" -o "$KEYRING_DEB"
110+
sudo dpkg -i "$KEYRING_DEB"
111+
sudo apt-get update
112+
113+
DEB_DIR="$CACHE_TMP_DIR/debs"
114+
DEB_ROOT="$CACHE_TMP_DIR/deb-root"
115+
mkdir -p "$DEB_DIR/partial" "$DEB_ROOT"
116+
DEB_DIR="$(realpath "$DEB_DIR")"
117+
IFS=, read -ra PREVIEW_PACKAGES <<< "$CTK_PREVIEW_PACKAGES"
118+
sudo apt-get install --yes --download-only --no-install-recommends \
119+
-o "Dir::Cache::archives=$DEB_DIR" \
120+
"${PREVIEW_PACKAGES[@]}"
121+
for package in "$DEB_DIR"/*.deb; do
122+
dpkg-deb -x "$package" "$DEB_ROOT"
123+
done
124+
125+
CUDA_SHORT_VERSION="${{ inputs.cuda-version }}"
126+
CUDA_SHORT_VERSION="${CUDA_SHORT_VERSION%.*}"
127+
CUDA_PACKAGE_ROOT="$DEB_ROOT/usr/local/cuda-${CUDA_SHORT_VERSION}"
128+
if [[ ! -d "$CUDA_PACKAGE_ROOT/include" ]]; then
129+
echo "CUDA prerelease packages did not provide $CUDA_PACKAGE_ROOT/include" >&2
130+
exit 1
131+
fi
132+
cp -a "$CUDA_PACKAGE_ROOT/." "$CACHE_TMP_DIR/"
133+
rm -rf "$DEB_DIR" "$DEB_ROOT" "$KEYRING_DEB"
134+
else
135+
# The binary archives (redist) are guaranteed to be updated as part of the release posting.
136+
# Use the runtime workspace mount so this also works inside container jobs.
137+
CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
138+
CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
139+
CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json"
140+
CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json"
141+
curl -fLSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE"
142+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
143+
function extract() {
144+
tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1
145+
}
146+
elif [[ "${{ inputs.host-platform }}" == "win-64" ]]; then
147+
function extract() {
148+
_TEMP_DIR_=$(mktemp -d)
149+
unzip $1 -d $_TEMP_DIR_
150+
cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR
151+
rm -rf $_TEMP_DIR_
152+
# see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5
153+
chmod 644 $CACHE_TMP_DIR/LICENSE
154+
}
155+
fi
156+
function populate_cuda_path() {
157+
# take the component name as a argument
158+
function download() {
159+
curl -fLSs $1 -o $2
160+
}
161+
CTK_COMPONENT=$1
162+
CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \
163+
--host-platform "${{ inputs.host-platform }}" \
164+
--component "$CTK_COMPONENT" \
165+
--metadata-path "$CTK_JSON_FILE")"
166+
CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}"
167+
CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)"
168+
download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME
169+
extract $CTK_COMPONENT_COMPONENT_FILENAME
170+
rm $CTK_COMPONENT_COMPONENT_FILENAME
90171
}
172+
173+
# Get headers and shared libraries in place
174+
for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do
175+
populate_cuda_path "$item"
176+
done
91177
fi
92-
function populate_cuda_path() {
93-
# take the component name as a argument
94-
function download() {
95-
curl -LSs $1 -o $2
96-
}
97-
CTK_COMPONENT=$1
98-
CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \
99-
--host-platform "${{ inputs.host-platform }}" \
100-
--component "$CTK_COMPONENT" \
101-
--metadata-path "$CTK_JSON_FILE")"
102-
CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}"
103-
CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)"
104-
download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME
105-
extract $CTK_COMPONENT_COMPONENT_FILENAME
106-
rm $CTK_COMPONENT_COMPONENT_FILENAME
107-
}
108-
109-
# Get headers and shared libraries in place
110-
for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do
111-
populate_cuda_path "$item"
112-
done
113178
# TODO: check Windows
114179
if [[ "${{ inputs.host-platform }}" == linux* && -d "${CACHE_TMP_DIR}/lib" ]]; then
115180
mv $CACHE_TMP_DIR/lib $CACHE_TMP_DIR/lib64

‎.github/workflows/build-docs.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ jobs:
6464
run: |
6565
if [[ -f ci/versions.yml ]]; then
6666
BUILD_CTK_VER=$(yq '.cuda.build.version' ci/versions.yml)
67+
BUILD_CTK_CHANNEL=$(yq '.cuda.build.channel // "stable"' ci/versions.yml)
6768
elif [[ -f ci/versions.json ]]; then
6869
BUILD_CTK_VER=$(jq -r '.cuda.build.version' ci/versions.json)
70+
BUILD_CTK_CHANNEL=$(jq -r '.cuda.build.channel // "stable"' ci/versions.json)
6971
else
7072
echo "error: cannot find ci/versions.yml or ci/versions.json" >&2
7173
exit 1
@@ -75,6 +77,7 @@ jobs:
7577
exit 1
7678
fi
7779
echo "BUILD_CTK_VER=${BUILD_CTK_VER}" >> "$GITHUB_ENV"
80+
echo "BUILD_CTK_CHANNEL=${BUILD_CTK_CHANNEL}" >> "$GITHUB_ENV"
7881
7982
# TODO: This workflow runs on GH-hosted runner and cannot use the proxy cache
8083

@@ -100,6 +103,7 @@ jobs:
100103
with:
101104
host-platform: linux-64
102105
cuda-version: ${{ env.BUILD_CTK_VER }}
106+
cuda-channel: ${{ env.BUILD_CTK_CHANNEL }}
103107

104108
- name: Set environment variables
105109
run: |

‎.github/workflows/build-wheel.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
cuda-version:
1212
required: true
1313
type: string
14+
cuda-channel:
15+
required: false
16+
type: string
17+
default: stable
1418
prev-cuda-version:
1519
required: true
1620
type: string
@@ -164,6 +168,7 @@ jobs:
164168
with:
165169
host-platform: ${{ inputs.host-platform }}
166170
cuda-version: ${{ inputs.cuda-version }}
171+
cuda-channel: ${{ inputs.cuda-channel }}
167172

168173
- name: Build cuda.bindings wheel
169174
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0

‎.github/workflows/ci.yml‎

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
outputs:
3333
CUDA_BUILD_VER: ${{ steps.get-vars.outputs.cuda_build_ver }}
34+
CUDA_BUILD_CHANNEL: ${{ steps.get-vars.outputs.cuda_build_channel }}
3435
CUDA_PREV_BUILD_VER: ${{ steps.get-vars.outputs.cuda_prev_build_ver }}
3536
steps:
3637
- name: Checkout repository
@@ -43,6 +44,9 @@ jobs:
4344
cuda_build_ver=$(yq '.cuda.build.version' ci/versions.yml)
4445
echo "cuda_build_ver=$cuda_build_ver" >> $GITHUB_OUTPUT
4546
47+
cuda_build_channel=$(yq '.cuda.build.channel // "stable"' ci/versions.yml)
48+
echo "cuda_build_channel=$cuda_build_channel" >> $GITHUB_OUTPUT
49+
4650
cuda_prev_build_ver=$(yq '.cuda.prev_build.version' ci/versions.yml)
4751
echo "cuda_prev_build_ver=$cuda_prev_build_ver" >> $GITHUB_OUTPUT
4852
@@ -250,6 +254,7 @@ jobs:
250254
with:
251255
host-platform: ${{ matrix.host-platform }}
252256
cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
257+
cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}
253258
prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }}
254259

255260
# See build-linux-64 for why build jobs are split by platform.
@@ -269,6 +274,7 @@ jobs:
269274
with:
270275
host-platform: ${{ matrix.host-platform }}
271276
cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
277+
cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}
272278
prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }}
273279

274280
# See build-linux-64 for why build jobs are split by platform.
@@ -282,12 +288,13 @@ jobs:
282288
host-platform:
283289
- win-64
284290
name: Build ${{ matrix.host-platform }}, CUDA ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
285-
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }}
291+
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) && needs.ci-vars.outputs.CUDA_BUILD_CHANNEL != 'prerelease' }}
286292
secrets: inherit
287293
uses: ./.github/workflows/build-wheel.yml
288294
with:
289295
host-platform: ${{ matrix.host-platform }}
290296
cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
297+
cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}
291298
prev-cuda-version: ${{ needs.ci-vars.outputs.CUDA_PREV_BUILD_VER }}
292299

293300
# NOTE: test-sdist jobs are split by platform (mirroring build-* and test-wheel-*)
@@ -307,14 +314,15 @@ jobs:
307314
with:
308315
host-platform: linux-64
309316
cuda-version: ${{ needs.ci-vars.outputs.CUDA_BUILD_VER }}
317+
cuda-channel: ${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}
310318

311319
# See test-sdist-linux for why sdist test jobs are split by platform.
312320
test-sdist-windows:
313321
needs:
314322
- ci-vars
315323
- should-skip
316324
name: Test sdist win-64
317-
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) }}
325+
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.skip) && !fromJSON(needs.should-skip.outputs.doc-only) && needs.ci-vars.outputs.CUDA_BUILD_CHANNEL != 'prerelease' }}
318326
secrets: inherit
319327
uses: ./.github/workflows/test-sdist-windows.yml
320328
with:
@@ -383,7 +391,7 @@ jobs:
383391
host-platform:
384392
- win-64
385393
name: Test ${{ matrix.host-platform }}
386-
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) }}
394+
if: ${{ github.repository_owner == 'nvidia' && !fromJSON(needs.should-skip.outputs.doc-only) && needs.ci-vars.outputs.CUDA_BUILD_CHANNEL != 'prerelease' }}
387395
permissions:
388396
contents: read # This is required for actions/checkout
389397
needs:
@@ -421,6 +429,7 @@ jobs:
421429
if: always()
422430
runs-on: ubuntu-latest
423431
needs:
432+
- ci-vars
424433
- should-skip
425434
- detect-changes
426435
- test-sdist-linux
@@ -447,6 +456,7 @@ jobs:
447456
fi
448457
449458
doc_only="${{ needs.should-skip.outputs.doc-only }}"
459+
cuda_build_channel="${{ needs.ci-vars.outputs.CUDA_BUILD_CHANNEL }}"
450460
status="success"
451461
check_result() {
452462
name=$1; expected=$2; result=$3
@@ -458,16 +468,28 @@ jobs:
458468
}
459469
460470
# always expected to succeed (even in [doc-only] mode)
471+
check_result "ci-vars" "success" "${{ needs.ci-vars.result }}"
461472
check_result "should-skip" "success" "${{ needs.should-skip.result }}"
462473
check_result "detect-changes" "success" "${{ needs.detect-changes.result }}"
463474
check_result "doc" "success" "${{ needs.doc.result }}"
464475
465-
# [doc-only] flips these from 'success' to 'skipped'
466-
if [[ "$doc_only" == "true" ]]; then expected="skipped"; else expected="success"; fi
467-
check_result "test-sdist-linux" "$expected" "${{ needs.test-sdist-linux.result }}"
468-
check_result "test-sdist-windows" "$expected" "${{ needs.test-sdist-windows.result }}"
469-
check_result "test-linux-64" "$expected" "${{ needs.test-linux-64.result }}"
470-
check_result "test-linux-aarch64" "$expected" "${{ needs.test-linux-aarch64.result }}"
471-
check_result "test-windows" "$expected" "${{ needs.test-windows.result }}"
476+
# [doc-only] skips all tests. Prerelease CUDA packages currently support
477+
# Linux only, so Windows tests are also skipped for that channel.
478+
if [[ "$doc_only" == "true" ]]; then
479+
linux_expected="skipped"
480+
windows_expected="skipped"
481+
else
482+
linux_expected="success"
483+
if [[ "$cuda_build_channel" == "prerelease" ]]; then
484+
windows_expected="skipped"
485+
else
486+
windows_expected="success"
487+
fi
488+
fi
489+
check_result "test-sdist-linux" "$linux_expected" "${{ needs.test-sdist-linux.result }}"
490+
check_result "test-sdist-windows" "$windows_expected" "${{ needs.test-sdist-windows.result }}"
491+
check_result "test-linux-64" "$linux_expected" "${{ needs.test-linux-64.result }}"
492+
check_result "test-linux-aarch64" "$linux_expected" "${{ needs.test-linux-aarch64.result }}"
493+
check_result "test-windows" "$windows_expected" "${{ needs.test-windows.result }}"
472494
473495
[[ "$status" == "success" ]]

‎.github/workflows/test-sdist-linux.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
cuda-version:
1212
required: true
1313
type: string
14+
cuda-channel:
15+
required: false
16+
type: string
17+
default: stable
1418

1519
defaults:
1620
run:
@@ -80,6 +84,7 @@ jobs:
8084
with:
8185
host-platform: ${{ inputs.host-platform }}
8286
cuda-version: ${{ inputs.cuda-version }}
87+
cuda-channel: ${{ inputs.cuda-channel }}
8388

8489
# cuda_bindings/setup.py parses CUDA headers at import time, so CUDA_PATH
8590
# (set by fetch_ctk) must be available for both sdist and wheel builds.

0 commit comments

Comments
 (0)