Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ cuda/_version.py export-subst
*.hpp binary
# git should not convert line endings in PNG files
*.png binary
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ cython_debug/

# Dont ignore
!.github/actions/build/
# pixi environments
.pixi/*
!.pixi/config.toml
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ repos:
language: python
additional_dependencies:
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
exclude: '.*pixi\.lock'

- id: no-markdown-in-docs-source
name: Prevent markdown files in docs/source directories
Expand Down
6 changes: 0 additions & 6 deletions cuda_bindings/benchmarks/pytest.ini

This file was deleted.

6,141 changes: 6,141 additions & 0 deletions cuda_bindings/pixi.lock

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions cuda_bindings/pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

[workspace]
channels = ["conda-forge"]
platforms = ["linux-64", "linux-aarch64", "win-64"]
preview = ["pixi-build"]

[workspace.build-variants]
python = ["3.10.*", "3.11.*", "3.12.*", "3.13.*", "3.14.*"]

[dependencies]
cuda-bindings = { path = "." }
pip = "*" # installed to the workspace for convenience

[feature.test.dependencies]
pytest = ">=6.2.4"
pytest-benchmark = ">=3.4.1"
pyglet = ">=2.1.9"
numpy = "*"

[feature.cython-tests.dependencies]
cython = "*" # for tests that exercise APIs from cython
setuptools = "*" # for distutils
gxx = "*" # to compile the generated code
# These are necessary because running the Cython tests requires compiling
# *after* the package is built, and the Cython tests depend on CUDA headers
# transitively (through cuda-bindings)
cuda-cudart-dev = "*"
cuda-profiler-api = "*"

[feature.cython-tests.target.linux-64.dependencies]
cuda-crt-dev_linux-64 = "*"

[feature.cython-tests.target.linux-aarch64.dependencies]
cuda-crt-dev_linux-aarch64 = "*"

[feature.cython-tests.target.win-64.dependencies]
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"

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

[feature.cython-tests.target.win-64.activation.env]
CUDA_HOME = '%CONDA_PREFIX%\Library'

[feature.cu13.system-requirements]
cuda = "13"

[feature.cu13.dependencies]
# TODO: make cuda-version a build-variant
cuda-version = "13.*"

[environments]
cu13 = { features = ["cu13", "test", "cython-tests"], solve-group = "cu13" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit unhappy having to pass -e cu13 explicitly for every pixi operation. In the next PR we should think about if this is avoidable.


# TODO: check if these can be extracted from pyproject.toml
[package]
name = "cuda-bindings"
version = "13.0.2"

[package.build]
backend = { name = "pixi-build-python", version = "*" }

[package.build.config]
env = { CUDA_PYTHON_PARSER_CACHING = "1", CUDA_PYTHON_PARALLEL_LEVEL = "$(nproc)" }
noarch = false
compilers = ["c", "cxx"]

[package.build.target.linux-64.config.env]
CUDA_HOME = "$PREFIX/targets/x86_64-linux"

[package.build.target.linux-aarch64.config.env]
CUDA_HOME = "$PREFIX/targets/sbsa-linux"

[package.build.target.win-64.config.env]
CUDA_HOME = '%PREFIX%\Library'

# TODO: revisit this
# [package.build-dependencies]
# ccache = "*"

[package.host-dependencies]
python = "*"
pip = "*"
setuptools = ">=77"
cython = ">=3.1,<3.2"
pyclibrary = ">=0.1.7"
cuda-cudart-static = "*"
cuda-nvrtc-dev = "*"
cuda-profiler-api = "*"
cuda-nvvm = "*"

[package.target.linux-64.host-dependencies]
cuda-crt-dev_linux-64 = "*"
libcufile-dev = "*"

[package.target.linux-aarch64.host-dependencies]
cuda-crt-dev_linux-aarch64 = "*"
libcufile-dev = "*"

[package.target.win-64.host-dependencies]
cuda-crt-dev_win-64 = "*"

[package.run-dependencies]
python = "*"
cuda-pathfinder = ">=1.1,<2"
cuda-bindings = { path = "." }
libnvjitlink = "*"
cuda-nvrtc = "*"
cuda-nvvm = "*"

[package.target.linux.run-dependencies]
libcufile = "*"

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

[target.linux.tasks.run-cython-tests]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a point to the complexity of creating a separate task just to run the cython tests and then making that a dependency of the test task?

Why not just run pytest $PIXI_PROJECT_ROOT? If that doesn't work for some reason (e.g., it can't discover the cython tests) then we should pass it on the command line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, Cython tests aren't auto-discoverable from the project root. We added a rule to exclude them. Feel free to simplify the task dependency. I only wanted to make sure it runs as intended, and thought adding 3 lines of code was not too bad.

cmd = ["pytest", "$PIXI_PROJECT_ROOT/tests/cython/"]
depends-on = [{ task = "build-cython-tests" }]

[target.linux.tasks.test]
cmd = ["pytest", "$PIXI_PROJECT_ROOT"]
depends-on = [{ task = "run-cython-tests" }]
20 changes: 11 additions & 9 deletions cuda_bindings/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ build-backend = "setuptools.build_meta"
[project]
name = "cuda-bindings"
description = "Python bindings for CUDA"
authors = [{name = "NVIDIA Corporation", email = "[email protected]"},]
authors = [
{ name = "NVIDIA Corporation", email = "[email protected]" },
]
license = "LicenseRef-NVIDIA-SOFTWARE-LICENSE"
requires-python = ">=3.10"
classifiers = [
Expand All @@ -22,13 +24,8 @@ classifiers = [
"Programming Language :: Python :: 3.14",
"Environment :: GPU :: NVIDIA CUDA",
]
dynamic = [
"version",
"readme",
]
dependencies = [
"cuda-pathfinder ~=1.1",
]
dynamic = ["version", "readme"]
dependencies = ["cuda-pathfinder ~=1.1"]

[project.optional-dependencies]
all = [
Expand All @@ -43,7 +40,7 @@ test = [
"numpy>=1.21.1",
"pytest>=6.2.4",
"pytest-benchmark>=3.4.1",
"pyglet>=2.1.9"
"pyglet>=2.1.9",
]

[project.urls]
Expand All @@ -69,3 +66,8 @@ archs = "native"
archs = "AMD64"
before-build = "pip install delvewheel"
repair-wheel-command = "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wheel}"

[tool.pytest.ini_options]
required_plugins = "pytest-benchmark"
addopts = "--benchmark-disable"
norecursedirs = ["tests/cython", "examples"]
5 changes: 0 additions & 5 deletions cuda_bindings/tests/pytest.ini

This file was deleted.

Loading
Loading