diff --git a/.github/workflows/test-wheel-linux.yml b/.github/workflows/test-wheel-linux.yml index 2f8e9a47a02..0bb470b26c3 100644 --- a/.github/workflows/test-wheel-linux.yml +++ b/.github/workflows/test-wheel-linux.yml @@ -467,9 +467,32 @@ jobs: pytest -rxXs -v tests/test_utils.py tests/example_tests/ 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' }} - run: python -m numba.runtests 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 != '' }} @@ -495,9 +518,13 @@ jobs: # 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 -rxXs -v \ --ignore=tests/benchmarks \ --ignore=tests/doc_examples \ + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_devicerecord.py::TestCudaDeviceRecordWithRecord::test_device_record_copy' \ tests/ popd @@ -520,8 +547,8 @@ jobs: # 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 deselect: drops automatically when a newer - # cuda-core release with the wrapper-mapping update ships. + # 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 @@ -531,6 +558,15 @@ jobs: --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 -rxXs -v --randomly-dont-reorganize \ "${DESELECTS[@]}" \ tests/ diff --git a/.github/workflows/test-wheel-windows.yml b/.github/workflows/test-wheel-windows.yml index 1b9fc0ff9cb..7abfc74126b 100644 --- a/.github/workflows/test-wheel-windows.yml +++ b/.github/workflows/test-wheel-windows.yml @@ -450,10 +450,27 @@ jobs: pytest -rxXs -v tests/test_utils.py tests/example_tests/ 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' }} + if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }} + env: + LOCAL_CTK: ${{ matrix.LOCAL_CTK }} shell: bash --noprofile --norc -xeuo pipefail {0} - run: python -m numba.runtests numba.cuda.tests + run: | + if [[ "${LOCAL_CTK}" != 1 ]]; then + export NUMBA_CUDA_TEST_WHEEL_ONLY=1 + fi + # See linux step for rationale on running from testing/ and -k. + 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 != '' }} @@ -476,9 +493,11 @@ jobs: pushd numba-cuda-mlir-released pip install --upgrade "pip>=25.1" pip install --group test + # See linux step for rationale on the --deselect. pytest -rxXs -v \ --ignore=tests/benchmarks \ --ignore=tests/doc_examples \ + --deselect 'tests/numba_cuda_tests/cudadrv/test_cuda_devicerecord.py::TestCudaDeviceRecordWithRecord::test_device_record_copy' \ tests/ popd @@ -517,6 +536,12 @@ jobs: --deselect 'tests/test_memory.py::test_non_managed_resources_report_not_managed[pinned]' ) 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 + # See linux step for rationale (#2792 revert). + DESELECTS+=( + --deselect 'tests/test_utils_enum_explanations_helpers.py::test_frozen_driver_table_covers_all_curesult_members' + ) + fi pytest -rxXs -v --randomly-dont-reorganize \ "${DESELECTS[@]}" \ tests/ diff --git a/ci/tools/run-tests b/ci/tools/run-tests index cfa7e9d6a7a..c882fae0517 100755 --- a/ci/tools/run-tests +++ b/ci/tools/run-tests @@ -162,10 +162,12 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then elif [[ "${test_module}" == "nightly-numba-cuda" ]]; then echo "Installing pathfinder + bindings + core + test deps + numba-cuda" # numba-cuda's test-cuXX group deps (can't use --group for a wheel install): + # numpy<2.5: numba-cuda 0.30.4 references np.row_stack, removed in numpy 2.5. See NVIDIA/numba-cuda#907. PIP_ARGS+=( "cuda-toolkit[curand,cublas]==${TEST_CUDA_MAJOR_MINOR}.*" "numba-cuda[cu${TEST_CUDA_MAJOR}]" "cupy-cuda${TEST_CUDA_MAJOR}x" + "numpy<2.5" psutil cffi pytest-xdist pytest-benchmark filecheck ml_dtypes statistics ) elif [[ "${test_module}" == "nightly-numba-cuda-mlir" ]]; then @@ -173,14 +175,24 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then # curand/cublas + cupy: some numba-cuda-mlir tests (e.g. # test_fortran_contiguous) call cp.random, which dlopens libcurand at # runtime. Mirror the numba-cuda branch, which installs the same libs. + # cccl: NVRTC needs for cooperative_groups / curand_kernel.h. PIP_ARGS+=( "numba-cuda-mlir[cu${TEST_CUDA_MAJOR}]" - "cuda-toolkit[curand,cublas]==${TEST_CUDA_MAJOR_MINOR}.*" + "cuda-toolkit[curand,cublas,cccl]==${TEST_CUDA_MAJOR_MINOR}.*" "cupy-cuda${TEST_CUDA_MAJOR}x" ) fi pip install "${PIP_ARGS[@]}" + + if [[ "${test_module}" == "nightly-numba-cuda" ]]; then + # Downgrade pytest for numba-cuda: cuda_core's test-cuXX group hard-pins + # pytest==9.1.0, but numba-cuda's subTest usage breaks under pytest 9. + # Can't add pytest<9 to PIP_ARGS above because pip can't satisfy both + # ==9.1.0 and <9 in one solve. See NVIDIA/numba-cuda#637. + pip install "pytest<9" + fi + echo "Nightly install complete — installed packages:" pip list popd @@ -193,6 +205,15 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then if [[ -n "${GITHUB_ENV:-}" ]]; then echo "NUMBA_CUDA_MLIR_VER=${installed_ver}" >> "${GITHUB_ENV}" fi + elif [[ "${test_module}" == "nightly-numba-cuda" ]]; then + # Expose the installed numba-cuda version so the workflow can + # actions/checkout the matching v tag from NVIDIA/numba-cuda + # (the wheel does not ship test_*.py files at a pytest-discoverable + # top level; upstream's testing/pytest.ini is required to run them). + installed_ver=$(pip show numba-cuda | awk '/^Version:/{print $2}') + if [[ -n "${GITHUB_ENV:-}" ]]; then + echo "NUMBA_CUDA_VER=${installed_ver}" >> "${GITHUB_ENV}" + fi fi fi fi