Skip to content

Commit 42bc9cd

Browse files
committed
Move pytest-run-parallel setup (and hopefully actually make it work)
1 parent eb6a2ff commit 42bc9cd

4 files changed

Lines changed: 15 additions & 24 deletions

File tree

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ jobs:
283283
# we use self-hosted runners on which setup-python behaves weirdly (Python include can't be found)...
284284
AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache"
285285

286-
- name: Install pytest-run-parallel for free-threaded Python
287-
if: endsWith(matrix.PY_VER, 't')
288-
run: pip install pytest-run-parallel
289-
290286
- name: Set up mini CTK
291287
if: ${{ matrix.LOCAL_CTK == '1' }}
292288
uses: ./.github/actions/fetch_ctk

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ jobs:
257257
with:
258258
python-version: ${{ matrix.PY_VER }}
259259

260-
- name: Install pytest-run-parallel for free-threaded Python
261-
if: endsWith(matrix.PY_VER, 't')
262-
run: pip install pytest-run-parallel
263-
264260
- name: Verify LongPathsEnabled
265261
run: |
266262
$val = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled').LongPathsEnabled

ci/tools/run-tests

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
44
#
55
# SPDX-License-Identifier: Apache-2.0
66

@@ -20,6 +20,14 @@ fi
2020

2121
test_module=${1}
2222

23+
FREE_THREADING=""
24+
PYTEST_PARALLEL_ARGS=()
25+
if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
26+
FREE_THREADING="-ft"
27+
PYTEST_PARALLEL_ARGS=(--parallel-threads=4)
28+
pip install pytest-run-parallel
29+
fi
30+
2331
# For standard modes, install pathfinder up front (it is a direct dependency
2432
# of bindings, and a transitive dependency of core). Nightly modes install
2533
# all wheels together in a single pip call further below.
@@ -36,7 +44,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then
3644
"LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
3745
"FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} " \
3846
"BC:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS}"
39-
pytest -ra -s -v --durations=0 tests/ |& tee /tmp/pathfinder_test_log.txt
47+
pytest -ra -s -v --durations=0 "${PYTEST_PARALLEL_ARGS[@]}" tests/ |& tee /tmp/pathfinder_test_log.txt
4048
# Report the number of "INFO test_" lines (including zero)
4149
# to support quick validations based on GHA log archives.
4250
line_count=$(awk '/^INFO test_/ {count++} END {print count+0}' /tmp/pathfinder_test_log.txt)
@@ -51,21 +59,16 @@ elif [[ "${test_module}" == "bindings" ]]; then
5159
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all] --group test
5260
fi
5361
echo "Running bindings tests"
54-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
62+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
5563
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
56-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
64+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
5765
fi
5866
popd
5967
elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
6068
# Shared setup for core and nightly modes.
6169
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${CUDA_VER})"
6270
CUDA_VER_MINOR="$(cut -d '.' -f 1-2 <<< "${CUDA_VER}")"
6371

64-
FREE_THREADING=""
65-
if python -c 'import sys; assert not sys._is_gil_enabled()' 2> /dev/null; then
66-
FREE_THREADING+="-ft"
67-
fi
68-
6972
# Resolve bindings based on BINDINGS_SOURCE (set by env-vars):
7073
# main/backport → local wheel from artifacts dir
7174
# published → install from PyPI by version
@@ -106,11 +109,11 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
106109
echo "Installed packages before core tests:"
107110
pip list
108111
echo "Running core tests"
109-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
112+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/
110113
# Currently our CI always installs the latest bindings (from either major version).
111114
# This is not compatible with the test requirements.
112115
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
113-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
116+
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize "${PYTEST_PARALLEL_ARGS[@]}" tests/cython
114117
fi
115118
else
116119
# Nightly optional-dependency testing.

scripts/run_tests.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ RUN_CYTHON=0
5757
RUN_EXAMPLES=1
5858
RUN_PTDS=1
5959
INSTALL_MODE=auto # auto|force|skip
60-
DEFAULT_PARALLEL_THREADS=0
61-
if python -mpip show pytest-run-parallel >/dev/null 2>&1; then
62-
DEFAULT_PARALLEL_THREADS=4
63-
fi
64-
PARALLEL_THREADS=${DEFAULT_PARALLEL_THREADS}
60+
PARALLEL_THREADS=0
6561
while [[ $# -gt 0 ]]; do
6662
case "$1" in
6763
-h|--help)

0 commit comments

Comments
 (0)