Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ jobs:
test "${#bindings_wheels[@]}" -eq 1
test -f "${bindings_wheels[0]}"
python -m pip install "${bindings_wheels[0]}" --group "${CURRENT_BINDINGS_ROOT}/pyproject.toml:test"
pushd ${{ env.CURRENT_BINDINGS_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd
python "${CURRENT_BINDINGS_CYTHON_TESTS_DIR}/build_tests.py"

- name: Upload cuda.bindings ${{ env.CURRENT_CUDA_MAJOR }} Cython tests
if: ${{ env.TEST_BINDINGS_CURRENT == 'true' }}
Expand All @@ -526,9 +524,7 @@ jobs:
exit 1
fi
pip install "${core_wheel}" --group ./cuda_core/pyproject.toml:test
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd
python "${CUDA_CORE_CYTHON_TESTS_DIR}/build_tests.py"

- name: Upload current cuda.core Cython tests
if: ${{ env.TEST_CORE_CURRENT == 'true' }}
Expand Down Expand Up @@ -623,9 +619,7 @@ jobs:
test "${#bindings_wheels[@]}" -eq 1
test -f "${bindings_wheels[0]}"
python -m pip install "${bindings_wheels[0]}" --group "${MAINTENANCE_BINDINGS_ROOT}/pyproject.toml:test"
pushd ${{ env.MAINTENANCE_BINDINGS_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd
python "${MAINTENANCE_BINDINGS_CYTHON_TESTS_DIR}/build_tests.py"

- name: Upload cuda.bindings ${{ env.MAINTENANCE_CUDA_MAJOR }} Cython tests
if: ${{ !inputs.single-cuda-major && env.TEST_BINDINGS_MAINTENANCE == 'true' }}
Expand Down Expand Up @@ -755,9 +749,7 @@ jobs:
exit 1
fi
pip install "${core_wheel}" --group ./cuda_core/pyproject.toml:test
pushd ${{ env.CUDA_CORE_CYTHON_TESTS_DIR }}
bash build_tests.sh
popd
python "${CUDA_CORE_CYTHON_TESTS_DIR}/build_tests.py"

- name: Upload maintenance cuda.core Cython tests
if: ${{ !inputs.single-cuda-major && env.TEST_CORE_MAINTENANCE == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings_12/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for generation provenance and review expectations.
From this directory, install with
`python -m pip install -v -e . --group test`, then run `python -m pytest tests/`.
Free-threaded development also needs the `test-ft` dependency group.
- Build Cython tests with `tests/cython/build_tests.sh` or `build_tests.bat`
- Build Cython tests with `python tests/cython/build_tests.py`
before running `python -m pytest tests/cython/`. This requires the matching
CUDA headers and compiler toolchain.
- Legacy samples remain under `examples/`; do not assume CUDA 13's sample
Expand Down
10 changes: 5 additions & 5 deletions cuda_bindings_12/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ and pip 25.1 or newer:
```console
cd cuda_bindings_12
python -m pip install -v -e . --group test
tests/cython/build_tests.sh
python tests/cython/build_tests.py
python -m pytest tests/ tests/cython/
```

Use `build_tests.bat` on Windows. Free-threaded Python also needs the
`test-ft` dependency group.
Free-threaded Python also needs the `test-ft` dependency group.

Versions follow reachable `v12.*` tags through standard `setuptools-scm`.
Source builds need the matching tag and the history connecting it to the
Expand Down Expand Up @@ -69,8 +68,9 @@ To run these tests:

Cython tests are located in `tests/cython` and need to be built. These builds have the same CUDA Toolkit header requirements as [Installing from Source](https://nvidia.github.io/cuda-python/cuda-bindings/12.9.7/install.html#requirements) where the major.minor version must match `cuda.bindings`. To build them:

1. Setup environment variable `CUDA_HOME` with the path to the CUDA Toolkit installation.
2. Run the `build_tests` script located in `tests/cython` appropriate to your platform. This will both cythonize the tests and build them.
1. Set `CUDA_PATH` or `CUDA_HOME` to the CUDA Toolkit installation path.
If both are set, `CUDA_PATH` takes precedence.
2. Run `python tests/cython/build_tests.py` to cythonize and build the tests.

To run these tests:
* `python -m pytest tests/cython/` against editable installations
Expand Down
10 changes: 5 additions & 5 deletions cuda_bindings_12/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ cuda-crt-dev_win-64 = "*"
# For finding headers when building the Cython tests.
[feature.cython-tests.target.linux-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/x86_64-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/x86_64-linux"

[feature.cython-tests.target.linux-aarch64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/sbsa-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/sbsa-linux"

[feature.cython-tests.target.win-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/Library"
CUDA_PATH = "$CONDA_PREFIX/Library"

[feature.cu12.dependencies]
cuda-version = "12.*"
Expand Down Expand Up @@ -139,11 +142,8 @@ libnvfatbin = "*"
[package.target.linux.run-dependencies]
libcufile = "*"

[target.linux.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.sh"]

[target.win-64.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.bat"]
[tasks.build-cython-tests]
cmd = 'python "$PIXI_PROJECT_ROOT/tests/cython/build_tests.py"'

[target.linux.tasks.test]
cmd = [
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings_12/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ build = [
"cython>=3.2.5,<3.3",
]
test = [
"cuda-pathfinder>=1.5",
"cython>=3.2.5,<3.3",
"setuptools>=80.0.0",
"numpy>=1.21.1",
Expand Down
12 changes: 0 additions & 12 deletions cuda_bindings_12/tests/cython/build_tests.bat

This file was deleted.

1 change: 1 addition & 0 deletions cuda_bindings_12/tests/cython/build_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def main() -> None:
raise SystemExit(f"no test_*.pyx files under {script_dir}")

ext_modules = _cythonize_tests(pyx_files)
build_shared._add_cython_test_include_dirs(ext_modules)

# pytest imports each extension by bare module name (see test_cython.py),
# so build in-place next to its .pyx regardless of the invoking cwd.
Expand Down
23 changes: 0 additions & 23 deletions cuda_bindings_12/tests/cython/build_tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion cuda_bindings_13/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ subpackage in the `cuda-python` monorepo.

- **Primary tests**: `pytest tests/`
- **Cython tests**:
- build: `tests/cython/build_tests.sh` (or platform equivalent)
- build: `python tests/cython/build_tests.py`
- run: `pytest tests/cython/`
- **Samples**: run pytest-based sample coverage in `tests/example_tests/`;
sample sources and instructions live in `../samples/cuda_bindings/`.
Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings_13/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To run these tests:
Cython tests are located in `tests/cython` and need to be built. These builds have the same CUDA Toolkit header requirements as [Installing from Source](https://nvidia.github.io/cuda-python/cuda-bindings/latest/install.html#requirements) where the major.minor version must match `cuda.bindings`. To build them:

1. Setup environment variable `CUDA_PATH` (or `CUDA_HOME`) with the path to the CUDA Toolkit installation. Note: If both are set, `CUDA_PATH` takes precedence.
2. Run the `build_tests` script located in `tests/cython` appropriate to your platform. This will both cythonize the tests and build them.
2. Run `python tests/cython/build_tests.py` to cythonize and build the tests.

To run these tests:
* `python -m pytest tests/cython/` against editable installations
Expand Down
13 changes: 13 additions & 0 deletions cuda_bindings_13/_build_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ def _get_cuda_path() -> str:
return cuda_path


def _add_cython_test_include_dirs(extensions, *package_include_dirs: Path) -> None:
"""Set the compiler include paths for the Cython test extensions."""
cuda_include_dir = Path(_get_cuda_path()) / "include"
include_dirs = [str(path) for path in (*package_include_dirs, cuda_include_dir)]
for extension in extensions:
if sys.platform == "win32":
extension.include_dirs.extend(include_dirs)
else:
# CPLUS_INCLUDE_PATH treated these directories as system headers.
for include_dir in include_dirs:
extension.extra_compile_args.extend(("-isystem", include_dir))


# -----------------------------------------------------------------------
# Toolchain selection

Expand Down
10 changes: 5 additions & 5 deletions cuda_bindings_13/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ cuda-crt-dev_win-64 = "*"
# For finding headers when building the Cython tests
[feature.cython-tests.target.linux-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/x86_64-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/x86_64-linux"

[feature.cython-tests.target.linux-aarch64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/sbsa-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/sbsa-linux"

[feature.cython-tests.target.win-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/Library"
CUDA_PATH = "$CONDA_PREFIX/Library"

[feature.cu12.dependencies]
cuda-version = "12.*"
Expand Down Expand Up @@ -152,11 +155,8 @@ libnvfatbin = "*"
[package.target.linux.run-dependencies]
libcufile = "*"

[target.linux.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.sh"]

[target.win-64.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.bat"]
[tasks.build-cython-tests]
cmd = 'python "$PIXI_PROJECT_ROOT/tests/cython/build_tests.py"'

[target.linux.tasks.test]
cmd = [
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings_13/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ build = [
"cython>=3.2.5,<3.3",
]
test = [
"cuda-pathfinder>=1.5",
"cython>=3.2.5,<3.3",
"setuptools>=80.0.0",
"numpy>=1.21.1",
Expand Down
12 changes: 0 additions & 12 deletions cuda_bindings_13/tests/cython/build_tests.bat

This file was deleted.

1 change: 1 addition & 0 deletions cuda_bindings_13/tests/cython/build_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def main() -> None:
raise SystemExit(f"no test_*.pyx files under {script_dir}")

ext_modules = _cythonize_tests(pyx_files)
build_shared._add_cython_test_include_dirs(ext_modules)

# pytest imports each extension by bare module name (see test_cython.py),
# so build in-place next to its .pyx regardless of the invoking cwd.
Expand Down
23 changes: 0 additions & 23 deletions cuda_bindings_13/tests/cython/build_tests.sh

This file was deleted.

2 changes: 1 addition & 1 deletion cuda_core/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ the literal floor.

- **Primary tests**: `pytest tests/`
- **Cython tests**:
- build: `tests/cython/build_tests.sh` (or platform equivalent)
- build: `python tests/cython/build_tests.py`
- run: `pytest tests/cython/`
- **Samples**: validate affected samples in `../samples/cuda_core/` when changing user
workflows or public APIs.
Expand Down
2 changes: 1 addition & 1 deletion cuda_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Builds run clang-tidy on the handwritten C++ sources (`cuda/core/_cpp/`) and fai
Cython tests are located in `tests/cython` and need to be built. These builds have the same CUDA Toolkit header requirements as [those of cuda.bindings](https://nvidia.github.io/cuda-python/cuda-bindings/latest/install.html#requirements) where the major.minor version must match `cuda.bindings`. To build them:

1. Set up environment variable `CUDA_PATH` (or `CUDA_HOME`) with the path to the CUDA Toolkit installation. Note: If both are set, `CUDA_PATH` takes precedence.
2. Run `build_tests` script located in `tests/cython` appropriate to your platform. This will both cythonize the tests and build them.
2. Run `python tests/cython/build_tests.py` to cythonize and build the tests.

To run these tests:
* `python -m pytest tests/cython/` with editable installations
Expand Down
10 changes: 5 additions & 5 deletions cuda_core/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,15 @@ cuda-crt-dev_win-64 = "*"
# For finding headers when building the Cython tests
[feature.cython-tests.target.linux-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/x86_64-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/x86_64-linux"

[feature.cython-tests.target.linux-aarch64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/targets/sbsa-linux"
CUDA_PATH = "$CONDA_PREFIX/targets/sbsa-linux"

[feature.cython-tests.target.win-64.activation.env]
CUDA_HOME = "$CONDA_PREFIX/Library"
CUDA_PATH = "$CONDA_PREFIX/Library"

[feature.cu13.dependencies]
cuda-version = "13.5.*"
Expand Down Expand Up @@ -294,8 +297,8 @@ numpy = "*"
cuda-bindings = "*"
cuda-pathfinder = "*"

[target.linux.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.sh"]
[tasks.build-cython-tests]
cmd = 'python "$PIXI_PROJECT_ROOT/tests/cython/build_tests.py"'

[target.linux.tasks.docs-build]
cmd = ["$PIXI_PROJECT_ROOT/docs/build_docs.sh"]
Expand All @@ -314,9 +317,6 @@ cmd = ["$PIXI_PROJECT_ROOT/docs/build_docs.sh", "latest-only"]
env = { SPHINXOPTS = "-v -j 1 -d build/.doctrees" }
default-environment = "docs"

[target.win-64.tasks.build-cython-tests]
cmd = ["$PIXI_PROJECT_ROOT/tests/cython/build_tests.bat"]

[target.linux.tasks.test]
cmd = [
"pytest",
Expand Down
1 change: 1 addition & 0 deletions cuda_core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ build = [
"clang-tidy==22.1.8; sys_platform != 'win32' or platform_machine != 'ARM64'",
]
test = [
"cuda-pathfinder>=1.5",
"cython>=3.2.5,<3.3",
"setuptools>=80",
"pytest==9.1.0",
Expand Down
2 changes: 2 additions & 0 deletions cuda_core/tests/cython/build_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def main() -> None:
# are stable regardless of the invoking cwd.
os.chdir(script_dir)
ext_modules = _cythonize_tests(pyx_files)
core_include_dir = script_dir.parents[1] / "cuda" / "core" / "_include"
build_shared._add_cython_test_include_dirs(ext_modules, core_include_dir)
# Core's runtime consumer headers require C++17 with either toolchain.
for extension in ext_modules:
extension.extra_compile_args.append("/std:c++17" if os.name == "nt" else "-std=c++17")
Expand Down
22 changes: 0 additions & 22 deletions cuda_core/tests/cython/build_tests.sh

This file was deleted.

Loading