Skip to content

Commit 0b7cc50

Browse files
leofangclaude
andcommitted
Fix nightly CI: single pip call, display step, numba cmd, Windows VC++
- Install ALL wheels (pathfinder + bindings + core) and optional dep (torch/numba-cuda) in a single pip call so pip resolves everything together and avoids costly reinstall cycles from version conflicts - Fix "Display structure" step: show only artifact files (cuda_python*.whl, cuda_pathfinder/) instead of ls -lahR . which lists the entire repo - Fix numba-cuda test command: python -m numba.runtests numba.cuda.tests - Install Visual C++ Redistributable on Windows before PyTorch (pytorch/pytorch#166628) - run-tests now does pip list at the end of nightly installs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9286598 commit 0b7cc50

3 files changed

Lines changed: 100 additions & 77 deletions

File tree

.github/workflows/test-wheel-linux.yml

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
- name: Display structure of downloaded cuda-python artifacts
206206
run: |
207207
pwd
208-
ls -lahR .
208+
ls -lah cuda_python*.whl cuda_pathfinder/
209209
210210
- name: Display structure of downloaded cuda.bindings artifacts
211211
run: |
@@ -343,41 +343,31 @@ jobs:
343343
CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS: all_must_work
344344
run: run-tests pathfinder
345345

346-
# ── Nightly: install all cuda-python wheels ──
347-
- name: Install cuda-python wheels for nightly testing
348-
if: ${{ inputs.test-mode != 'standard' }}
346+
# ── Nightly: install wheels + optional dep together ──
347+
- name: Install cuda-python wheels + PyTorch
348+
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
349349
env:
350350
CUDA_VER: ${{ matrix.CUDA_VER }}
351351
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
352-
run: run-tests nightly-install
352+
TORCH_VER: ${{ matrix.TORCH_VER }}
353+
TORCH_CUDA: ${{ matrix.TORCH_CUDA }}
354+
run: run-tests nightly-pytorch
353355

354-
# ── Nightly: PyTorch interop tests ──
355-
- name: Install PyTorch
356-
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
357-
run: |
358-
TORCH_VER="${{ matrix.TORCH_VER }}"
359-
TORCH_CUDA="${{ matrix.TORCH_CUDA }}"
360-
if [[ "$TORCH_VER" == "latest" ]]; then
361-
pip install torch --index-url "https://download.pytorch.org/whl/${TORCH_CUDA}"
362-
else
363-
pip install "torch==${TORCH_VER}" --index-url "https://download.pytorch.org/whl/${TORCH_CUDA}"
364-
fi
365-
python -c "import torch; print(f'PyTorch {torch.__version__}, CUDA {torch.version.cuda}')"
356+
- name: Install cuda-python wheels + numba-cuda
357+
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
358+
env:
359+
CUDA_VER: ${{ matrix.CUDA_VER }}
360+
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
361+
run: run-tests nightly-numba-cuda
366362

363+
# ── Nightly: run tests ──
367364
- name: Run PyTorch interop tests
368365
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
369366
run: |
370367
pushd cuda_core
371368
pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/
372369
popd
373370
374-
# ── Nightly: numba-cuda tests ──
375-
- name: Install numba-cuda
376-
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
377-
run: |
378-
pip install numba-cuda
379-
python -c "import numba_cuda; print(f'numba-cuda installed')"
380-
381371
- name: Run numba-cuda tests
382372
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
383-
run: python -m numba_cuda.numba.cuda.tests
373+
run: python -m numba.runtests numba.cuda.tests

.github/workflows/test-wheel-windows.yml

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ jobs:
191191
- name: Display structure of downloaded cuda-python artifacts
192192
run: |
193193
Get-Location
194-
Get-ChildItem -Recurse -Force | Select-Object Mode, LastWriteTime, Length, FullName
194+
Get-ChildItem cuda_python*.whl | Select-Object Mode, LastWriteTime, Length, FullName
195+
Get-ChildItem cuda_pathfinder/ | Select-Object Mode, LastWriteTime, Length, FullName
195196
196197
- name: Display structure of downloaded cuda.bindings artifacts
197198
run: |
@@ -320,29 +321,33 @@ jobs:
320321
shell: bash --noprofile --norc -xeuo pipefail {0}
321322
run: run-tests pathfinder
322323

323-
# ── Nightly: install all cuda-python wheels ──
324-
- name: Install cuda-python wheels for nightly testing
325-
if: ${{ inputs.test-mode != 'standard' }}
324+
# ── Nightly: install wheels + optional dep together ──
325+
- name: Install Visual C++ Redistributable (required by PyTorch on Windows)
326+
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
327+
run: |
328+
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "vc_redist.x64.exe"
329+
Start-Process -FilePath ".\vc_redist.x64.exe" -ArgumentList "/install", "/quiet", "/norestart" -Wait
330+
Remove-Item "vc_redist.x64.exe"
331+
332+
- name: Install cuda-python wheels + PyTorch
333+
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
326334
env:
327335
CUDA_VER: ${{ matrix.CUDA_VER }}
328336
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
337+
TORCH_VER: ${{ matrix.TORCH_VER }}
338+
TORCH_CUDA: ${{ matrix.TORCH_CUDA }}
329339
shell: bash --noprofile --norc -xeuo pipefail {0}
330-
run: run-tests nightly-install
340+
run: run-tests nightly-pytorch
331341

332-
# ── Nightly: PyTorch interop tests ──
333-
- name: Install PyTorch
334-
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
342+
- name: Install cuda-python wheels + numba-cuda
343+
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
344+
env:
345+
CUDA_VER: ${{ matrix.CUDA_VER }}
346+
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
335347
shell: bash --noprofile --norc -xeuo pipefail {0}
336-
run: |
337-
TORCH_VER="${{ matrix.TORCH_VER }}"
338-
TORCH_CUDA="${{ matrix.TORCH_CUDA }}"
339-
if [[ "$TORCH_VER" == "latest" ]]; then
340-
pip install torch --index-url "https://download.pytorch.org/whl/${TORCH_CUDA}"
341-
else
342-
pip install "torch==${TORCH_VER}" --index-url "https://download.pytorch.org/whl/${TORCH_CUDA}"
343-
fi
344-
python -c "import torch; print(f'PyTorch {torch.__version__}, CUDA {torch.version.cuda}')"
348+
run: run-tests nightly-numba-cuda
345349

350+
# ── Nightly: run tests ──
346351
- name: Run PyTorch interop tests
347352
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
348353
shell: bash --noprofile --norc -xeuo pipefail {0}
@@ -351,15 +356,7 @@ jobs:
351356
pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/
352357
popd
353358
354-
# ── Nightly: numba-cuda tests ──
355-
- name: Install numba-cuda
356-
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
357-
shell: bash --noprofile --norc -xeuo pipefail {0}
358-
run: |
359-
pip install numba-cuda
360-
python -c "import numba_cuda; print(f'numba-cuda installed')"
361-
362359
- name: Run numba-cuda tests
363360
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
364361
shell: bash --noprofile --norc -xeuo pipefail {0}
365-
run: python -m numba_cuda.numba.cuda.tests
362+
run: python -m numba.runtests numba.cuda.tests

ci/tools/run-tests

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ if [[ ${#} -ne 1 ]]; then
1313
echo "Error: This script requires exactly 1 argument. You provided ${#}"
1414
exit 1
1515
fi
16-
if [[ "${1}" != "bindings" && "${1}" != "core" && "${1}" != "pathfinder" && "${1}" != "nightly-install" ]]; then
17-
echo "Error: Invalid test module '${1}'. Must be 'bindings', 'core', 'pathfinder', or 'nightly-install'"
16+
if [[ "${1}" != "bindings" && "${1}" != "core" && "${1}" != "pathfinder" && "${1}" != "nightly-pytorch" && "${1}" != "nightly-numba-cuda" ]]; then
17+
echo "Error: Invalid test module '${1}'. Must be 'bindings', 'core', 'pathfinder', 'nightly-pytorch', or 'nightly-numba-cuda'"
1818
exit 1
1919
fi
2020

2121
test_module=${1}
2222

23-
# Unconditionally install pathfinder wheel
24-
# (it is a direct dependency of bindings, and a transitive dependency of core)
25-
pushd ./cuda_pathfinder
26-
echo "Installing pathfinder wheel"
27-
pip install ./*.whl --group test
28-
popd
23+
# For standard modes, install pathfinder up front (it is a direct dependency
24+
# of bindings, and a transitive dependency of core). Nightly modes install
25+
# all wheels together in a single pip call further below.
26+
if [[ "${test_module}" != "nightly-pytorch" && "${test_module}" != "nightly-numba-cuda" ]]; then
27+
pushd ./cuda_pathfinder
28+
echo "Installing pathfinder wheel"
29+
pip install ./*.whl --group test
30+
popd
31+
fi
2932

3033
if [[ "${test_module}" == "pathfinder" ]]; then
3134
pushd ./cuda_pathfinder
@@ -91,35 +94,68 @@ elif [[ "${test_module}" == "core" ]]; then
9194
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
9295
fi
9396
popd
94-
elif [[ "${test_module}" == "nightly-install" ]]; then
95-
# Install all wheels (pathfinder already installed above) without running tests.
96-
# Used by nightly optional-dependency pipelines (pytorch, numba-cuda).
97-
echo "Installing bindings wheel"
98-
pushd ./cuda_bindings
99-
if [[ "${LOCAL_CTK}" == 1 ]]; then
100-
pip install "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl
101-
else
102-
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all]
103-
fi
104-
popd
97+
elif [[ "${test_module}" == "nightly-pytorch" || "${test_module}" == "nightly-numba-cuda" ]]; then
98+
# Nightly optional-dependency testing.
99+
# Install ALL wheels (pathfinder + bindings + core) and the optional dep
100+
# in a single pip call so pip resolves version constraints in one shot
101+
# and avoids costly uninstall/reinstall cycles.
102+
#
103+
# We pushd into cuda_core/ so that --group reads test dependency groups
104+
# from cuda_core/pyproject.toml (needed for numpy, cupy, ml_dtypes, etc.).
105+
# All other wheel paths use ../ to reach the repo root.
105106

106107
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})"
107-
echo "Installing core wheel"
108+
CUDA_VER_MINOR="$(cut -d '.' -f 1-2 <<< "${CUDA_VER}")"
108109

109110
FREE_THREADING=""
110111
if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
111112
FREE_THREADING+="-ft"
112113
fi
113114

115+
# Resolve the pathfinder wheel path before pushd (it's relative to repo root).
116+
# CUDA_BINDINGS_ARTIFACTS_DIR and CUDA_CORE_ARTIFACTS_DIR are already absolute
117+
# (set via realpath in env-vars).
118+
PATHFINDER_WHL=($(realpath ./cuda_pathfinder/*.whl))
119+
114120
pushd ./cuda_core
115-
CUDA_VER_MINOR="$(cut -d '.' -f 1-2 <<< "${CUDA_VER}")"
116-
WHL_EXTRA=("${CUDA_CORE_ARTIFACTS_DIR}"/*.whl)
121+
122+
# Build wheel specs (paths are absolute, so pushd doesn't affect them)
123+
BINDINGS_WHL=("${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)
117124
if [[ "${LOCAL_CTK}" != 1 ]]; then
118-
WHL_EXTRA=("${WHL_EXTRA[0]}[cu${TEST_CUDA_MAJOR}]")
125+
BINDINGS_WHL=("${BINDINGS_WHL[0]}[all]")
119126
fi
120-
pip install "${WHL_EXTRA[@]}" --group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}" "cuda-toolkit==${CUDA_VER_MINOR}.*"
127+
128+
CORE_WHL=("${CUDA_CORE_ARTIFACTS_DIR}"/*.whl)
129+
if [[ "${LOCAL_CTK}" != 1 ]]; then
130+
CORE_WHL=("${CORE_WHL[0]}[cu${TEST_CUDA_MAJOR}]")
131+
fi
132+
133+
# All packages in one pip call: pathfinder + bindings + core + test deps + optional dep
134+
PIP_ARGS=(
135+
"${PATHFINDER_WHL[@]}"
136+
"${BINDINGS_WHL[@]}"
137+
"${CORE_WHL[@]}"
138+
--group "test-cu${TEST_CUDA_MAJOR}${FREE_THREADING}"
139+
"cuda-toolkit==${CUDA_VER_MINOR}.*"
140+
)
141+
142+
if [[ "${test_module}" == "nightly-pytorch" ]]; then
143+
# TORCH_VER and TORCH_CUDA must be set by the caller.
144+
echo "Installing pathfinder + bindings + core + test deps + PyTorch ${TORCH_VER} (${TORCH_CUDA})"
145+
if [[ "${TORCH_VER}" == "latest" ]]; then
146+
PIP_ARGS+=(torch)
147+
else
148+
PIP_ARGS+=("torch==${TORCH_VER}")
149+
fi
150+
PIP_ARGS+=(--extra-index-url "https://download.pytorch.org/whl/${TORCH_CUDA}")
151+
elif [[ "${test_module}" == "nightly-numba-cuda" ]]; then
152+
echo "Installing pathfinder + bindings + core + test deps + numba-cuda"
153+
PIP_ARGS+=("numba-cuda[cu${TEST_CUDA_MAJOR}]")
154+
fi
155+
156+
pip install "${PIP_ARGS[@]}"
121157
popd
122158

123-
echo "All cuda-python wheels installed for nightly testing"
124-
pip list | grep -i "cuda\|pathfinder"
159+
echo "Nightly install complete — installed packages:"
160+
pip list
125161
fi

0 commit comments

Comments
 (0)