Skip to content

Commit 910597a

Browse files
committed
Merge main into ajost/vmm-fabric
2 parents 001192a + 63efb2d commit 910597a

400 files changed

Lines changed: 35598 additions & 8125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
## Description
22

3-
<!-- Every PR should have a corresponding issue that describes and motivates the work done in the PR -->
3+
<!-- Link the relevant issue, if any. -->
44
closes <!-- Link issue here -->
55

66
<!-- Provide a standalone description of changes in this PR. -->
77

88
<!-- Note: The pull request title will be included in the CHANGELOG. -->
99

1010
## Checklist
11-
<!-- TODO: - [ ] I am familiar with the [Contributing Guidelines](). -->
11+
- [ ] I have read the [Contributing Guidelines](https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md#coordinate-before-implementing).
1212
- [ ] New or existing tests cover these changes.
1313
- [ ] The documentation is up to date with these changes.

‎.github/actionlint.yaml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ paths:
1515
".github/workflows/build-docs.yml":
1616
ignore:
1717
- 'unexpected key "queue" for "concurrency" section'
18+
# GitHub supports self-repository ($/) action references, but the latest
19+
# actionlint release does not yet recognize them (rhysd/actionlint#711).
20+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
1821
".github/workflows/cleanup-pr-previews.yml":
1922
ignore:
2023
- 'unexpected key "queue" for "concurrency" section'
@@ -32,3 +35,15 @@ paths:
3235
".github/workflows/test-wheel-windows.yml":
3336
ignore:
3437
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
38+
".github/workflows/build-wheel.yml":
39+
ignore:
40+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
41+
".github/workflows/pre-commit.yml":
42+
ignore:
43+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
44+
".github/workflows/test-sdist-windows.yml":
45+
ignore:
46+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'
47+
".github/workflows/coverage.yml":
48+
ignore:
49+
- 'specifying action "\$/[^"]+" in invalid format because ref is missing'

‎.github/actions/doc_preview/action.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
steps:
2121
- name: Deploy doc preview
2222
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
23-
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
23+
uses: JamesIves/github-pages-deploy-action@fa24774553152dd7873cd16ebd8d959b010c5445 # v4.9.0
2424
with:
2525
git-config-name: cuda-python-bot
2626
git-config-email: [email protected]
@@ -35,7 +35,7 @@ runs:
3535

3636
- name: Leave a comment after deployment
3737
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
38-
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
38+
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
3939
with:
4040
header: pr-preview
4141
number: ${{ inputs.pr-number }}

‎.github/actions/download-artifact-retry/action.yml‎

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,33 @@
55
name: Download artifact (with retry)
66

77
description: >-
8-
Wrapper around actions/download-artifact that retries once after a short
9-
delay when the first attempt fails. Designed to absorb transient
10-
infrastructure flakes such as "other side closed" without failing the job.
8+
Wrapper around actions/download-artifact that retries up to three times with
9+
exponential backoff when a download fails. Handles both transient TCP errors
10+
such as "other side closed" and storage-layer throttling such as
11+
"HTTP 503: Egress is over the account limit". Accepts either an exact
12+
artifact name or a glob pattern; supply exactly one.
1113
1214
inputs:
1315
name:
14-
description: "Name of the artifact to download"
15-
required: true
16+
description: >-
17+
Exact name of the artifact to download. Mutually exclusive with
18+
'pattern'; supply exactly one of the two.
19+
required: false
20+
default: ""
21+
pattern:
22+
description: >-
23+
Glob pattern matching one or more artifact names. Mutually exclusive
24+
with 'name'; supply exactly one of the two.
25+
required: false
26+
default: ""
27+
merge-multiple:
28+
description: >-
29+
When true and 'pattern' is set, merge files from all matched artifacts
30+
directly into 'path' instead of placing each in its own subdirectory.
31+
required: false
32+
default: "false"
1633
path:
17-
description: "Destination path for the downloaded artifact"
34+
description: "Destination path for the downloaded artifact(s)"
1835
required: true
1936
run-id:
2037
description: >-
@@ -32,39 +49,80 @@ inputs:
3249
required: false
3350
default: ""
3451
retry-delay-seconds:
35-
description: "Seconds to wait between the first failure and the retry"
52+
description: "Seconds to wait between the first failure and the second attempt"
3653
required: false
3754
default: "15"
3855

3956
runs:
4057
using: composite
4158
steps:
59+
- name: Validate inputs
60+
shell: bash --noprofile --norc -euo pipefail {0}
61+
env:
62+
INPUT_NAME: ${{ inputs.name }}
63+
INPUT_PATTERN: ${{ inputs.pattern }}
64+
run: |
65+
if [[ -n "${INPUT_NAME}" && -n "${INPUT_PATTERN}" ]]; then
66+
echo "::error::Specify exactly one of 'name' or 'pattern', not both"
67+
exit 1
68+
fi
69+
if [[ -z "${INPUT_NAME}" && -z "${INPUT_PATTERN}" ]]; then
70+
echo "::error::Specify exactly one of 'name' or 'pattern'"
71+
exit 1
72+
fi
73+
4274
- name: Download artifact (attempt 1)
4375
id: attempt1
4476
continue-on-error: true
4577
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
4678
with:
4779
name: ${{ inputs.name }}
80+
pattern: ${{ inputs.pattern }}
81+
merge-multiple: ${{ inputs.merge-multiple }}
4882
path: ${{ inputs.path }}
4983
run-id: ${{ inputs.run-id }}
5084
github-token: ${{ inputs.github-token }}
5185

52-
- name: Wait before retry
86+
- name: Wait before retry (attempt 2)
5387
if: ${{ steps.attempt1.outcome == 'failure' }}
5488
shell: bash --noprofile --norc -euo pipefail {0}
5589
env:
56-
# Pass through env instead of interpolating the input into the shell
57-
# script, so a non-numeric value cannot inject commands.
5890
RETRY_DELAY_SECONDS: ${{ inputs.retry-delay-seconds }}
5991
run: |
6092
echo "::warning::Artifact download failed (attempt 1); retrying in ${RETRY_DELAY_SECONDS}s"
6193
sleep "$RETRY_DELAY_SECONDS"
6294
6395
- name: Download artifact (attempt 2)
96+
id: attempt2
6497
if: ${{ steps.attempt1.outcome == 'failure' }}
98+
continue-on-error: true
99+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
100+
with:
101+
name: ${{ inputs.name }}
102+
pattern: ${{ inputs.pattern }}
103+
merge-multiple: ${{ inputs.merge-multiple }}
104+
path: ${{ inputs.path }}
105+
run-id: ${{ inputs.run-id }}
106+
github-token: ${{ inputs.github-token }}
107+
108+
- name: Wait before retry (attempt 3)
109+
if: ${{ steps.attempt1.outcome == 'failure' && steps.attempt2.outcome == 'failure' }}
110+
shell: bash --noprofile --norc -euo pipefail {0}
111+
env:
112+
RETRY_DELAY_SECONDS: ${{ inputs.retry-delay-seconds }}
113+
run: |
114+
# Double the delay for the second retry to give egress throttling more time to clear.
115+
RETRY_DELAY_SECONDS=$(( RETRY_DELAY_SECONDS * 2 ))
116+
echo "::warning::Artifact download failed (attempt 2); retrying in ${RETRY_DELAY_SECONDS}s"
117+
sleep "$RETRY_DELAY_SECONDS"
118+
119+
- name: Download artifact (attempt 3)
120+
if: ${{ steps.attempt1.outcome == 'failure' && steps.attempt2.outcome == 'failure' }}
65121
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
66122
with:
67123
name: ${{ inputs.name }}
124+
pattern: ${{ inputs.pattern }}
125+
merge-multiple: ${{ inputs.merge-multiple }}
68126
path: ${{ inputs.path }}
69127
run-id: ${{ inputs.run-id }}
70128
github-token: ${{ inputs.github-token }}

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

Lines changed: 110 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,116 @@ inputs:
1919
description: "where the CTK components will be installed to, relative to $PWD"
2020
required: false
2121
default: "./cuda_toolkit"
22+
install-mode:
23+
description: >
24+
"replace" (default) empties cuda-path before installing.
25+
"add" installs the components on top of the mini CTK that an earlier
26+
fetch_ctk call installed at the same cuda-path, and leaves the
27+
environment that call exported unchanged.
28+
required: false
29+
default: "replace"
30+
redist-base-url:
31+
description: >
32+
Base URL of a redistrib server (manifest and component archives).
33+
Defaults to the public NVIDIA developer server.
34+
Override to install from an alternate redistrib server.
35+
required: false
36+
default: "https://developer.download.nvidia.com/compute/cuda/redist"
2237

2338
runs:
2439
using: composite
2540
steps:
41+
- name: Install Unix dependencies
42+
if: ${{ runner.os == 'Linux' }}
43+
uses: ./.github/actions/install_unix_deps
44+
with:
45+
dependencies: "zstd curl xz-utils"
46+
dependent_exes: "zstd curl xz"
47+
48+
- name: Install Windows dependencies
49+
if: ${{ runner.os == 'Windows' }}
50+
uses: ./.github/actions/install_windows_deps
51+
with:
52+
dependent_exes: "curl unzip tar sha256sum cygpath"
53+
54+
- name: Check install mode
55+
shell: bash --noprofile --norc -xeuo pipefail {0}
56+
run: |
57+
case "${{ inputs.install-mode }}" in
58+
replace)
59+
;;
60+
add)
61+
# The environment exports are skipped in this mode, so the target
62+
# must be the CUDA_PATH an earlier fetch_ctk call exported.
63+
if [[ -z "${CUDA_PATH:-}" ]]; then
64+
echo "::error::install-mode 'add' requires CUDA_PATH from an earlier fetch_ctk call"
65+
exit 1
66+
fi
67+
EXISTING_PATH="$CUDA_PATH"
68+
if [[ "${{ inputs.host-platform }}" == win* ]]; then
69+
EXISTING_PATH="$(cygpath -u "$EXISTING_PATH")"
70+
fi
71+
if [[ "$(realpath -e "${{ inputs.cuda-path }}")" != "$(realpath -e "$EXISTING_PATH")" ]]; then
72+
echo "::error::install-mode 'add' requires cuda-path to be the existing CUDA_PATH ($CUDA_PATH)"
73+
exit 1
74+
fi
75+
;;
76+
*)
77+
echo "::error::install-mode must be 'replace' or 'add', got '${{ inputs.install-mode }}'"
78+
exit 1
79+
;;
80+
esac
81+
2682
- name: Set up CTK cache variable
2783
shell: bash --noprofile --norc -xeuo pipefail {0}
2884
run: |
29-
# Pre-process the component list to ensure hash uniqueness
3085
# Use the runtime workspace mount so this also works inside container jobs.
3186
CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
32-
CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }}
33-
CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json"
87+
CTK_BASE_URL="${{ inputs.redist-base-url }}"
88+
# A trailing slash would defeat the public-server comparison below and double up in URLs.
89+
CTK_BASE_URL="${CTK_BASE_URL%/}"
90+
# RUNNER_TEMP persists across steps, so "Get CUDA components" reuses this file.
91+
CTK_JSON_FILE="$RUNNER_TEMP/redistrib-${{ inputs.cuda-version }}.json"
92+
curl -LSs --fail --retry 3 --retry-delay 2 "${CTK_BASE_URL}/redistrib_${{ inputs.cuda-version }}.json" -o "$CTK_JSON_FILE"
93+
94+
# Pin the metadata JSON: the per-archive sha256 checks below are only
95+
# trustworthy if the JSON that carries those hashes is itself trusted.
96+
# The pins describe the public server; alternate servers only warn.
97+
if [[ "$CTK_BASE_URL" == "https://developer.download.nvidia.com/compute/cuda/redist" ]]; then
98+
METADATA_SOURCE=public
99+
else
100+
METADATA_SOURCE=custom
101+
fi
102+
python "$CTK_REDIST_TOOL" verify-metadata \
103+
--cuda-version "${{ inputs.cuda-version }}" \
104+
--metadata-path "$CTK_JSON_FILE" \
105+
--metadata-source "$METADATA_SOURCE"
106+
107+
# Pre-process the component list to ensure hash uniqueness
34108
CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \
35109
--host-platform "${{ inputs.host-platform }}" \
36110
--cuda-version "${{ inputs.cuda-version }}" \
37-
--components "$CTK_CACHE_COMPONENTS" \
38-
--metadata-url "$CTK_JSON_URL")"
111+
--components "${{ inputs.cuda-components }}" \
112+
--metadata-path "$CTK_JSON_FILE")"
39113
114+
# Alternate redist servers (non-default) publish different manifests for the
115+
# same CUDA version; keying on the full manifest hash keeps them from restoring
116+
# each other's toolkit (a truncated hash could be collided on purpose).
117+
# Hash via stdin: with a backslash in the path (Windows RUNNER_TEMP), sha256sum
118+
# prefixes its output line with "\", which would end up in the cache key.
119+
MANIFEST_SHA256="$(sha256sum < "$CTK_JSON_FILE" | awk '{print $1}')"
40120
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
42-
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH.tar.gz" >> $GITHUB_ENV
43-
echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}" >> $GITHUB_ENV
44-
45-
- name: Install dependencies
46-
uses: ./.github/actions/install_unix_deps
47-
continue-on-error: false
48-
with:
49-
dependencies: "zstd curl xz-utils"
50-
dependent_exes: "zstd curl xz"
121+
{
122+
echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256"
123+
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH-m$MANIFEST_SHA256.tar.gz"
124+
echo "CTK_CACHE_COMPONENTS=${CTK_CACHE_COMPONENTS}"
125+
echo "CTK_BASE_URL=${CTK_BASE_URL}"
126+
echo "CTK_JSON_FILE=${CTK_JSON_FILE}"
127+
} >> "$GITHUB_ENV"
51128
52129
- name: Download CTK cache
53130
id: ctk-get-cache
54-
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
131+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
55132
continue-on-error: true
56133
with:
57134
key: ${{ env.CTK_CACHE_KEY }}
@@ -68,13 +145,10 @@ runs:
68145
rm -rf $CACHE_TMP_DIR
69146
mkdir $CACHE_TMP_DIR
70147
71-
# The binary archives (redist) are guaranteed to be updated as part of the release posting.
72148
# Use the runtime workspace mount so this also works inside container jobs.
73149
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"
150+
# CTK_BASE_URL and the verified manifest at CTK_JSON_FILE come from
151+
# "Set up CTK cache variable".
78152
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
79153
function extract() {
80154
tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1
@@ -102,6 +176,13 @@ runs:
102176
CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}"
103177
CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)"
104178
download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME
179+
# Verify the downloaded archive against the sha256 in the (pinned)
180+
# metadata before extracting; fail closed on any mismatch.
181+
CTK_COMPONENT_SHA256="$(python "$CTK_REDIST_TOOL" component-sha256 \
182+
--host-platform "${{ inputs.host-platform }}" \
183+
--component "$CTK_COMPONENT" \
184+
--metadata-path "$CTK_JSON_FILE")"
185+
echo "${CTK_COMPONENT_SHA256} ${CTK_COMPONENT_COMPONENT_FILENAME}" | sha256sum --check --strict -
105186
extract $CTK_COMPONENT_COMPONENT_FILENAME
106187
rm $CTK_COMPONENT_COMPONENT_FILENAME
107188
}
@@ -125,7 +206,9 @@ runs:
125206
# symlinks from a prerelease CTK at ./cuda_toolkit/include etc., causing
126207
# "cp: cannot overwrite non-directory" failures on the next restore).
127208
CUDA_PATH="${{ inputs.cuda-path }}"
128-
rm -rf $CUDA_PATH
209+
if [[ "${{ inputs.install-mode }}" == replace ]]; then
210+
rm -rf $CUDA_PATH
211+
fi
129212
mkdir -p $CUDA_PATH
130213
# Unfortunately we cannot use "rsync -av $CACHE_TMP_DIR/ $CUDA_PATH" because
131214
# not all runners have rsync pre-installed (or even installable, such as
@@ -137,7 +220,7 @@ runs:
137220
- name: Upload CTK cache
138221
if: ${{ !cancelled() &&
139222
steps.ctk-get-cache.outputs.cache-hit != 'true' }}
140-
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
223+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
141224
with:
142225
key: ${{ env.CTK_CACHE_KEY }}
143226
path: ./${{ env.CTK_CACHE_FILENAME }}
@@ -149,7 +232,9 @@ runs:
149232
ls -l
150233
CACHE_TMP_DIR="./cache_tmp_dir"
151234
CUDA_PATH="${{ inputs.cuda-path }}"
152-
rm -rf $CUDA_PATH
235+
if [[ "${{ inputs.install-mode }}" == replace ]]; then
236+
rm -rf $CUDA_PATH
237+
fi
153238
mkdir -p $CUDA_PATH
154239
tar -xzvf $CTK_CACHE_FILENAME
155240
# Can't use rsync here, see above
@@ -158,6 +243,7 @@ runs:
158243
ls -l $CUDA_PATH
159244
160245
- name: Set output environment variables
246+
if: ${{ inputs.install-mode == 'replace' }}
161247
shell: bash --noprofile --norc -xeuo pipefail {0}
162248
run: |
163249
# mimics actual CTK installation

‎.github/actions/griffe-api-check/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
using: composite
2626
steps:
2727
- name: Install uv
28-
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
28+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
2929
with:
3030
enable-cache: false
3131

0 commit comments

Comments
 (0)