Repository navigation
587 lines (528 loc) · 27.3 KB
/
Copy pathtest-wheel-linux.yml
File metadata and controls
587 lines (528 loc) · 27.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: "CI: Test wheels"
on:
workflow_call:
inputs:
build-type:
type: string
required: true
host-platform:
type: string
required: true
build-ctk-ver:
type: string
required: true
matrix_filter:
type: string
default: "."
nruns:
type: number
default: 1
workplan:
description: JSON workplan. An empty value tests everything.
type: string
default: ""
run-id:
description: >
Workflow run ID to download artifacts from.
Defaults to the current run when empty.
type: string
default: ''
test-mode:
description: >
Test mode: 'standard' (default), 'nightly-pytorch',
'nightly-numba-cuda', 'nightly-numba-cuda-mlir', or
'nightly-cuda-core'.
type: string
default: 'standard'
sha:
description: >
Commit SHA used to construct artifact names.
Defaults to github.sha (current run) when empty.
type: string
default: ''
defaults:
run:
shell: bash --noprofile --norc -xeuo pipefail {0}
jobs:
compute-matrix:
runs-on: ubuntu-latest
env:
BUILD_TYPE: ${{ inputs.build-type }}
ARCH: ${{ (inputs.host-platform == 'linux-64' && 'amd64') ||
(inputs.host-platform == 'linux-aarch64' && 'arm64') }}
outputs:
MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }}
OLD_BRANCH: ${{ steps.compute-matrix.outputs.OLD_BRANCH }}
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Validate Test Type
run: |
if [[ "$BUILD_TYPE" != "pull-request" ]] && [[ "$BUILD_TYPE" != "nightly" ]] && [[ "$BUILD_TYPE" != "branch" ]]; then
echo "Invalid build type! Must be one of 'nightly', 'pull-request', or 'branch'."
exit 1
fi
- name: Compute Python Test Matrix
id: compute-matrix
run: |
# Use the nightly matrix for branch tests
MATRIX_TYPE="${BUILD_TYPE}"
if [[ "${MATRIX_TYPE}" == "branch" ]]; then
MATRIX_TYPE="nightly"
fi
# Read base matrix from YAML file for the specific architecture
TEST_MATRIX=$(yq -o json ".linux[\"${MATRIX_TYPE}\"] | map(select(.ARCH == \"${ARCH}\"))" ci/test-matrix.yml)
# Apply matrix filter; reject custom DRIVER + FLAVOR=wsl (the
# in-container driver swap doesn't work under WSL); add a
# RUNNER_DRIVER field that maps any custom version back to
# 'latest' (the install script swaps the driver itself, so we
# need to land on the runner that ships with the most recent
# pre-installed driver); wrap in include structure.
MATRIX=$(echo "$TEST_MATRIX" | jq -c '${{ inputs.matrix_filter }} | if any(.[]; .DRIVER != "latest" and .DRIVER != "earliest" and .FLAVOR == "wsl") then "Error: custom DRIVER is not supported with FLAVOR=wsl\n" | halt_error(1) else . end | map(. + {RUNNER_DRIVER: (if .DRIVER == "latest" or .DRIVER == "earliest" then .DRIVER else "latest" end)}) | if (. | length) > 0 then {include: .} else "Error: Empty matrix\n" | halt_error(1) end')
echo "MATRIX=${MATRIX}" | tee --append "${GITHUB_OUTPUT}"
# This job has yq already installed, so let's do it here
OLD_BRANCH=$(yq '.backport_branch' ci/versions.yml)
echo "OLD_BRANCH=${OLD_BRANCH}" >> "$GITHUB_OUTPUT"
test:
env:
TEST_PATHFINDER: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.pathfinder.needs_test }}
TEST_BINDINGS: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.bindings.needs_test }}
TEST_CORE: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.core.needs_test }}
TEST_PYTHON: ${{ inputs.workplan == '' || fromJSON(inputs.workplan).modules.python.needs_test }}
name: Python ${{ matrix.PY_VER }}, CUDA ${{ matrix.CUDA_VER }} (${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}), GPU ${{ matrix.GPU }}${{ matrix.GPU_COUNT != '1' && format(' (x{0})', matrix.GPU_COUNT) || '' }}${{ matrix.FLAVOR && format(', {0}', matrix.FLAVOR) || '' }}${{ matrix.ENV.TORCH_VER && format(', {0}+{1}', matrix.ENV.TORCH_VER, matrix.ENV.TORCH_CUDA) || '' }}${{ matrix.ENV.MODE == 'nightly-numba-cuda' && ', latest' || '' }}
timeout-minutes: 60
needs: compute-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
runs-on: "${{ matrix.FLAVOR || 'linux' }}-${{ matrix.ARCH }}-gpu-${{ matrix.GPU }}-${{ matrix.RUNNER_DRIVER }}-${{ matrix.GPU_COUNT }}"
# The build stage could fail but we want the CI to keep moving.
if: ${{ github.repository_owner == 'nvidia' && !cancelled() }}
# Our self-hosted runners require a container
# TODO: use a different (nvidia?) container
container:
# Custom-DRIVER rows need --privileged --pid=host so install_gpu_driver.sh
# can nsenter to the host for the install + refresh the toolkit bind mounts
# back inside the container. Stock options for latest/earliest rows.
options: ${{ ((matrix.DRIVER == 'latest' || matrix.DRIVER == 'earliest') && '-u root --security-opt seccomp=unconfined --shm-size 16g') || '-u root --security-opt seccomp=unconfined --shm-size 16g --privileged --pid=host' }}
image: ubuntu:24.04
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
PIP_CACHE_DIR: "/tmp/pip-cache"
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Test sources must match the wheels under test (nightly runs
# reuse wheels built from an older commit of main).
ref: ${{ inputs.sha || github.sha }}
- name: Setup proxy cache
uses: nv-gha-runners/setup-proxy-cache@main
continue-on-error: true
- name: Install dependencies
uses: ./.github/actions/install_unix_deps
continue-on-error: false
with:
# for artifact fetching, graphics libs, g++ required for cffi in
# example; util-linux for `nsenter` (custom-DRIVER rows re-exec
# install_gpu_driver.sh onto the host through nsenter)
# yq: ci/tools/env-vars reads ci/versions.yml with it
dependencies: "jq wget libgl1 libegl1 g++ util-linux yq"
dependent_exes: "jq wget yq"
- name: Install GPU driver
if: ${{ matrix.DRIVER != 'latest' && matrix.DRIVER != 'earliest' }}
env:
DRIVER: ${{ matrix.DRIVER }}
GPU_TYPE: ${{ matrix.GPU }}
run: ./ci/tools/install_gpu_driver.sh
- name: Ensure GPU is working
run: nvidia-smi
- name: Set environment variables
env:
BUILD_CUDA_VER: ${{ inputs.build-ctk-ver }}
CUDA_VER: ${{ matrix.CUDA_VER }}
HOST_PLATFORM: ${{ inputs.host-platform }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
PY_VER: ${{ matrix.PY_VER }}
SHA: ${{ inputs.sha || github.sha }}
SKIP_BINDINGS_TEST_OVERRIDE: ${{ env.TEST_BINDINGS != 'true' && '1' || '0' }}
run: ./ci/tools/env-vars test
- name: Apply extra matrix environment variables
if: ${{ matrix.ENV }}
env:
MATRIX_ENV: ${{ toJSON(matrix.ENV) }}
run: echo "$MATRIX_ENV" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> "$GITHUB_ENV"
- name: Download cuda-pathfinder build artifacts
if: ${{ env.TEST_PATHFINDER == 'true' || env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' || env.TEST_PYTHON == 'true' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: cuda-pathfinder-wheel
path: ./cuda_pathfinder
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download cuda-python build artifacts
if: ${{ env.TEST_PYTHON == 'true' && env.BINDINGS_SOURCE == 'main' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: cuda-python-wheel
path: .
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download cuda.bindings build artifacts
if: ${{ (env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' || env.TEST_PYTHON == 'true') &&
env.BINDINGS_SOURCE == 'main' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download cuda-python & cuda.bindings build artifacts from the prior branch
if: ${{ (env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' || env.TEST_PYTHON == 'true') &&
env.BINDINGS_SOURCE == 'backport' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt.
# gh is needed for artifact fetching.
mkdir -p -m 755 /etc/apt/keyrings \
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& cat $out | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& 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 \
&& apt update \
&& apt install gh -y
OLD_BRANCH=${{ needs.compute-matrix.outputs.OLD_BRANCH }}
OLD_ARTIFACT_PATTERN="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda*-${{ inputs.host-platform }}-*[0-9a-f]"
LOOKUP_ARGS=(
--branch "${OLD_BRANCH}"
--artifact "${OLD_ARTIFACT_PATTERN}"
)
if ${{ env.TEST_PYTHON == 'true' }}; then
LOOKUP_ARGS+=(--artifact cuda-python-wheel)
fi
LATEST_PRIOR_RUN_ID=$(./ci/tools/lookup-run-id \
"${LOOKUP_ARGS[@]}" NVIDIA/cuda-python "CI")
gh run download \
"${LATEST_PRIOR_RUN_ID}" \
-p "${OLD_ARTIFACT_PATTERN}" \
-R NVIDIA/cuda-python
OLD_ARTIFACT_DIR=$(compgen -G "${OLD_ARTIFACT_PATTERN}")
test -d "${OLD_ARTIFACT_DIR}"
ls -al "${OLD_ARTIFACT_DIR}"
mkdir -p "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
mv "${OLD_ARTIFACT_DIR}"/*.whl "${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"/
rmdir "${OLD_ARTIFACT_DIR}"
if ${{ env.TEST_PYTHON == 'true' }}; then
gh run download \
"${LATEST_PRIOR_RUN_ID}" \
-p cuda-python-wheel \
-R NVIDIA/cuda-python
ls -al cuda-python-wheel
mv cuda-python-wheel/*.whl .
rmdir cuda-python-wheel
fi
- name: Display structure of downloaded cuda-python artifacts
if: ${{ env.TEST_PYTHON == 'true' && env.BINDINGS_SOURCE != 'floor' }}
run: |
pwd
ls -lah cuda_python*.whl cuda_pathfinder/
- name: Display structure of downloaded cuda.bindings artifacts
if: ${{ (env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' || env.TEST_PYTHON == 'true') &&
env.BINDINGS_SOURCE != 'floor' }}
run: |
pwd
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
- name: Download cuda.bindings Cython tests
if: ${{ env.TEST_BINDINGS == 'true' && env.SKIP_CYTHON_TEST == '0' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}-tests
path: ${{ env.CUDA_BINDINGS_CYTHON_TESTS_DIR }}
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Display structure of downloaded cuda.bindings Cython tests
if: ${{ env.TEST_BINDINGS == 'true' && env.SKIP_CYTHON_TEST == '0' }}
run: |
pwd
ls -lahR $CUDA_BINDINGS_CYTHON_TESTS_DIR
- name: Download cuda.core build artifacts
if: ${{ env.TEST_CORE == 'true' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Display structure of downloaded cuda.core build artifacts
if: ${{ env.TEST_CORE == 'true' }}
run: |
pwd
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
- name: Download cuda.core Cython tests
if: ${{ env.TEST_CORE == 'true' && env.SKIP_CYTHON_TEST == '0' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-tests
path: ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Display structure of downloaded cuda.core Cython tests
if: ${{ env.TEST_CORE == 'true' && env.SKIP_CYTHON_TEST == '0' }}
run: |
pwd
ls -lahR $CUDA_CORE_CYTHON_TESTS_DIR
- name: Download cuda.core test binaries
if: ${{ env.TEST_CORE == 'true' }}
uses: NVIDIA/cuda-python/.github/actions/download-artifact-retry@f20d661666a5c92b757748ca237d3592ac3e942f # introduced in #3037
with:
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}-test-binaries
path: ${{ env.CUDA_CORE_TEST_BINARIES_DIR }}
run-id: ${{ inputs.run-id || github.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Display structure of downloaded cuda.core test binaries
if: ${{ env.TEST_CORE == 'true' }}
run: |
pwd
ls -lahR $CUDA_CORE_TEST_BINARIES_DIR
- name: Set up Python ${{ matrix.PY_VER }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.PY_VER }}
allow-prereleases: ${{ startsWith(matrix.PY_VER, '3.16') }}
env:
# we use self-hosted runners on which setup-python behaves weirdly (Python include can't be found)...
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
- name: Set up mini CTK
if: ${{ matrix.LOCAL_CTK == '1' }}
uses: ./.github/actions/fetch_ctk
continue-on-error: false
with:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ matrix.CUDA_VER }}
- name: Set up latest cuda_sanitizer_api
if: ${{ (env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true') && env.SETUP_SANITIZER == '1' }}
uses: ./.github/actions/fetch_ctk
continue-on-error: false
with:
host-platform: ${{ inputs.host-platform }}
cuda-version: ${{ env.LATEST_CUDA_VERSION }}
cuda-components: "cuda_sanitizer_api"
- name: Set up compute-sanitizer
if: ${{ env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' }}
run: setup-sanitizer
- name: Set up test repetition on nightly runs
run: echo "PYTEST_ADDOPTS=\"--count=${{ inputs.nruns }}\"" >> "$GITHUB_ENV"
- name: Register problem matchers
# compute-sanitizer findings in the test output become annotations
# on the job page. Sanitizer runs are Linux-only.
run: echo "::add-matcher::.github/matchers/compute-sanitizer.json"
# ── Standard test steps (skipped for nightly modes) ──
- name: Run cuda.pathfinder tests with see_what_works
if: ${{ inputs.test-mode == 'standard' && env.TEST_PATHFINDER == 'true' }}
env:
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: see_what_works
CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: see_what_works
CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: see_what_works
run: run-tests pathfinder
- name: Run cuda.bindings tests
if: ${{ inputs.test-mode == 'standard' && env.TEST_BINDINGS == 'true' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests bindings
- name: Run cuda.bindings benchmarks (smoke test)
if: ${{ inputs.test-mode == 'standard' && env.TEST_BINDINGS == 'true' && env.SKIP_CUDA_BINDINGS_TEST == '0' }}
run: |
pip install pyperf
pushd benchmarks/cuda_bindings
python run_pyperf.py --debug-single-value
popd
- name: Run cuda.core tests
if: ${{ inputs.test-mode == 'standard' && env.TEST_CORE == 'true' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests core
- name: Ensure cuda-python installable
if: ${{ inputs.test-mode == 'standard' && env.TEST_PYTHON == 'true' && env.BINDINGS_SOURCE == 'main' }}
run: |
# Package suites install their own dependencies. A metapackage-only
# run has no preceding suite, so install the exact local internal
# wheels in one transaction while resolving released dependencies
# such as cuda-core from the package index.
if ${{ env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' }}; then
dependency_args=(--no-deps)
else
dependency_args=(
./cuda_pathfinder/cuda_pathfinder-*.whl
"${CUDA_BINDINGS_ARTIFACTS_DIR}"/cuda_bindings-*.whl
)
fi
python_requirements=(cuda_python*.whl)
if [[ "${{ matrix.LOCAL_CTK }}" != 1 ]]; then
python_requirements=("${python_requirements[@]/%/[all]}")
fi
pip install --only-binary=:all: "${dependency_args[@]}" "${python_requirements[@]}"
- name: Install cuda.pathfinder extra wheels for testing
if: ${{ inputs.test-mode == 'standard' && env.TEST_PATHFINDER == 'true' }}
run: |
set -euo pipefail
pushd cuda_pathfinder
pip install --only-binary=:all: -v ./*.whl --group "test-cu${TEST_CUDA_MAJOR}"
pip list
popd
- name: Run cuda.pathfinder tests with all_must_work
if: ${{ inputs.test-mode == 'standard' && env.TEST_PATHFINDER == 'true' }}
env:
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS: all_must_work
CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS: all_must_work
CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: all_must_work
run: run-tests pathfinder
# ── Nightly: install wheels + optional dep together ──
- name: Install cuda-python wheels + PyTorch
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests nightly-pytorch
- name: Install cuda-python wheels + numba-cuda
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests nightly-numba-cuda
- name: Install cuda-python wheels + numba-cuda-mlir
if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests nightly-numba-cuda-mlir
- name: Install main pathfinder/bindings + released cuda-core
if: ${{ inputs.test-mode == 'nightly-cuda-core' }}
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests nightly-cuda-core
# ── Nightly: run tests ──
- name: Run PyTorch interop tests
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
run: |
pushd cuda_core
pytest -rsxXfE -v --exclude-warning-annotations --junitxml "${GITHUB_WORKSPACE}/test-results/junit-pytorch-interop.xml" tests/test_utils.py tests/example_tests/ | python "${GITHUB_WORKSPACE}/ci/tools/fold_pytest_sections.py"
popd
- name: Checkout numba-cuda tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: NVIDIA/numba-cuda
ref: v${{ env.NUMBA_CUDA_VER }}
path: numba-cuda-released
- name: Run numba-cuda tests
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
env:
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: |
if [[ "${LOCAL_CTK}" != 1 ]]; then
# Let numba-cuda skip inputs that require toolkit executables.
export NUMBA_CUDA_TEST_WHEEL_ONLY=1
fi
# Run from numba-cuda's testing/ dir so its pytest.ini kicks in
# (consider_namespace_packages=true + --pyargs numba.cuda.tests).
# -k "not TestIpc": numba-cuda v0.30.4 accesses CUipcMemHandle.reserved,
# which cuda-bindings intentionally removed. numba-cuda is EOL upstream,
# so no fix is coming. See cuda-python#2748. The affected tests all
# live in the two TestIpcMemory/TestIpcStaged classes in test_ipc.py.
pushd numba-cuda-released/testing
pytest -v -k "not TestIpc"
popd
- name: Checkout numba-cuda-mlir tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: NVIDIA/numba-cuda-mlir
ref: v${{ env.NUMBA_CUDA_MLIR_VER }}
path: numba-cuda-mlir-released
- name: Run numba-cuda-mlir tests
if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }}
env:
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: |
if [[ "${LOCAL_CTK}" != 1 ]]; then
# Let numba-cuda-mlir skip inputs that require toolkit executables.
export NUMBA_CUDA_MLIR_TEST_WHEEL_ONLY=1
fi
pushd numba-cuda-mlir-released
# Install this tag's test deps (pytest + plugins + ml-dtypes + ...).
pip install --upgrade "pip>=25.1"
pip install --group test
# Skip tests/benchmarks/ and tests/doc_examples/ — they import the
# numba package at collection time, which cuSIMT intentionally does
# not depend on. See NVIDIA/numba-cuda-mlir#136.
# test_device_record_copy (WithRecord variant): flaky NaN vs NaN
# compare from uninitialized np.recarray memory. See
# NVIDIA/numba-cuda-mlir#341.
pytest -rsxXfE -v --exclude-warning-annotations \
--junitxml "${GITHUB_WORKSPACE}/test-results/junit-numba-cuda-mlir.xml" \
--ignore=tests/benchmarks \
--ignore=tests/doc_examples \
--deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_devicerecord.py::TestCudaDeviceRecordWithRecord::test_device_record_copy' \
tests/ | python "${GITHUB_WORKSPACE}/ci/tools/fold_pytest_sections.py"
popd
- name: Checkout released cuda-core tests at matching tag
if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: cuda-core-v${{ env.CUDA_CORE_RELEASED_VER }}
path: cuda-core-released
- name: Run released cuda-core tests
if: ${{ inputs.test-mode == 'nightly-cuda-core' && env.CUDA_CORE_RELEASED_VER != '' }}
run: |
pushd cuda-core-released/cuda_core
# Install the released tag's test group so we exercise the exact deps
# that cuda-core version shipped with.
pip install --upgrade "pip>=25.1"
pip install --group "${CUDA_CORE_TEST_GROUP}"
# Cap pytest below 9.1: released cuda-core <=1.0.1 has parametrize
# patterns that pytest 9.1 rejects; the main-side fix (#2212) has
# not yet shipped in a cuda-core release.
pip install "pytest<9.1"
# Version-gated deselects: drop automatically when a newer
# cuda-core release ships that removes each source.
DESELECTS=()
if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${CUDA_CORE_RELEASED_VER}') <= Version('1.0.1') else 1)"; then
# NvlinkVersion: v1.0.1's wrapper mapping predates
# NvlinkVersion.VERSION_6_0 which main cuda-bindings adds.
# Expected drift on this mode until released cuda-core catches up.
DESELECTS+=(
--deselect 'tests/test_enum_coverage.py::test_wrapper_covers_all_binding_members[NvlinkVersion]'
)
fi
if python -c "from packaging.version import Version; import sys; sys.exit(0 if Version('${CUDA_CORE_RELEASED_VER}') <= Version('1.2.1') else 1)"; then
# test_frozen_driver_table_covers_all_curesult_members: v1.2.1's
# frozen table (capped at CTK 13.1.1) predates 3 CUresult members
# added by main cuda-bindings 13.4.1. Reverted on main by #2792;
# drop this deselect once a cuda-core release with the revert ships.
DESELECTS+=(
--deselect 'tests/test_utils_enum_explanations_helpers.py::test_frozen_driver_table_covers_all_curesult_members'
)
fi
pytest -rsxXfE -v --randomly-dont-reorganize \
--junitxml "${GITHUB_WORKSPACE}/test-results/junit-cuda-core-released.xml" \
"${DESELECTS[@]}" \
tests/ | python "${GITHUB_WORKSPACE}/ci/tools/fold_pytest_sections.py"
popd
- name: Upload test results
# JUnit XML written by run-tests, one file per suite: a machine-readable
# record of the run, kept for 14 days. The name must be unique per job
# in the run.
if: ${{ !cancelled() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-results-${{ inputs.test-mode }}-${{ inputs.host-platform }}-py${{ matrix.PY_VER }}-cu${{ matrix.CUDA_VER }}-${{ (matrix.LOCAL_CTK == '1' && 'local') || 'wheels' }}-${{ matrix.GPU }}-x${{ matrix.GPU_COUNT }}-${{ matrix.DRIVER }}${{ matrix.FLAVOR && format('-{0}', matrix.FLAVOR) || '' }}
path: test-results/
if-no-files-found: ignore
retention-days: 14