Skip to content

Commit 7f11565

Browse files
committed
Merge branch 'main' into reduce_cudart
2 parents 7852459 + 1256bc1 commit 7f11565

File tree

113 files changed

+15963
-13201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+15963
-13201
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ jobs:
139139
# CIBW mounts the host filesystem under /host
140140
CIBW_ENVIRONMENT_LINUX: >
141141
CUDA_PATH=/host/${{ env.CUDA_PATH }}
142+
LIBRARY_PATH=/host/${{ env.CUDA_PATH }}/lib
142143
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
143144
CIBW_ENVIRONMENT_WINDOWS: >
144145
CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})"
146+
LIB="${CUDA_HOME}\\lib\\x64;${LIB}"
145147
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
146148
with:
147149
package-dir: ./cuda_bindings/

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ jobs:
6262
TEST_CUDA_MAJOR="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
6363
if [[ $BUILD_CUDA_MAJOR != $TEST_CUDA_MAJOR ]]; then
6464
SKIP_CUDA_BINDINGS_TEST=1
65+
SKIP_CUDA_CORE_CYTHON_TEST=0
6566
else
6667
SKIP_CUDA_BINDINGS_TEST=0
68+
BUILD_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${{ inputs.build-ctk-ver }})"
69+
TEST_CUDA_MINOR="$(cut -d '.' -f 2 <<< ${{ inputs.cuda-version }})"
70+
if [[ $BUILD_CUDA_MINOR != $TEST_CUDA_MINOR ]]; then
71+
SKIP_CUDA_CORE_CYTHON_TEST=1
72+
else
73+
SKIP_CUDA_CORE_CYTHON_TEST=0
74+
fi
6775
fi
6876
6977
# make outputs from the previous job as env vars
@@ -77,6 +85,7 @@ jobs:
7785
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
7886
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
7987
echo "SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $GITHUB_ENV
88+
echo "SKIP_CUDA_CORE_CYTHON_TEST=${SKIP_CUDA_CORE_CYTHON_TEST}" >> $GITHUB_ENV
8089
8190
- name: Install dependencies
8291
uses: ./.github/actions/install_unix_deps
@@ -185,7 +194,7 @@ jobs:
185194
186195
pushd ./cuda_bindings
187196
pip install -r requirements.txt
188-
pytest -rxXs tests/
197+
pytest -rxXs -v tests/
189198
190199
# It is a bit convoluted to run the Cython tests against CTK wheels,
191200
# so let's just skip them.
@@ -196,9 +205,9 @@ jobs:
196205
# TODO: enable this once win-64 runners are up
197206
exit 1
198207
fi
199-
pytest -rxXs tests/cython
200-
popd
208+
pytest -rxXs -v tests/cython
201209
fi
210+
popd
202211
203212
- name: Run cuda.core tests
204213
run: |
@@ -220,7 +229,22 @@ jobs:
220229
221230
pushd ./cuda_core
222231
pip install -r "tests/requirements-cu${TEST_CUDA_MAJOR}.txt"
223-
pytest -rxXs tests/
232+
pytest -rxXs -v tests/
233+
234+
# It is a bit convoluted to run the Cython tests against CTK wheels,
235+
# so let's just skip them. Also, currently our CI always installs the
236+
# latest bindings (from either major version). This is not compatible
237+
# with the test requirements.
238+
if [[ "${{ inputs.local-ctk }}" == 1 && "${SKIP_CUDA_CORE_CYTHON_TEST}" == 0 ]]; then
239+
pip install cython setuptools # setuptools needed starting PY312
240+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
241+
bash tests/cython/build_tests.sh
242+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
243+
# TODO: enable this once win-64 runners are up
244+
exit 1
245+
fi
246+
pytest -rxXs -v tests/cython
247+
fi
224248
popd
225249
226250
- name: Ensure cuda-python installable

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ jobs:
186186
187187
Push-Location ./cuda_bindings
188188
pip install -r requirements.txt
189-
pytest -rxXs tests/
190-
# skip Cython tests for now
189+
pytest -rxXs -v tests/
190+
# skip Cython tests for now (NVIDIA/cuda-python#466)
191191
Pop-Location
192192
193193
- name: Run cuda.core tests
@@ -210,7 +210,7 @@ jobs:
210210
211211
Push-Location ./cuda_core
212212
pip install -r "tests/requirements-cu${TEST_CUDA_MAJOR}.txt"
213-
pytest -rxXs tests/
213+
pytest -rxXs -v tests/
214214
Pop-Location
215215
216216
- name: Ensure cuda-python installable

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ __pycache__/
1717
# CUDA Python specific (auto-generated)
1818
cuda_bindings/cuda/bindings/_bindings/cydriver.pxd
1919
cuda_bindings/cuda/bindings/_bindings/cydriver.pyx
20+
cuda_bindings/cuda/bindings/_bindings/cyruntime.pxi
21+
cuda_bindings/cuda/bindings/_bindings/cyruntime.pxd
22+
cuda_bindings/cuda/bindings/_bindings/cyruntime.pyx
23+
cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pxd
24+
cuda_bindings/cuda/bindings/_bindings/cyruntime_ptds.pyx
2025
cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd
2126
cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx
2227
cuda_bindings/cuda/bindings/_internal/nvjitlink.pyx

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python. It c
44

55
* [cuda.core](https://nvidia.github.io/cuda-python/cuda-core/latest): Pythonic access to CUDA Runtime and other core functionalities
66
* [cuda.bindings](https://nvidia.github.io/cuda-python/cuda-bindings/latest): Low-level Python bindings to CUDA C APIs
7-
* [cuda.cooperative](https://nvidia.github.io/cccl/cuda_cooperative/): Pythonic exposure of CUB cooperative algorithms
8-
* [cuda.parallel](https://nvidia.github.io/cccl/cuda_parallel/): Pythonic exposure of Thrust parallel algorithms
7+
* [cuda.cooperative](https://nvidia.github.io/cccl/cuda_cooperative/): A Python package for easy access to highly efficient and customizable parallel algorithms, like `sort`, `scan`, `reduce`, `transform`, etc.
8+
* [cuda.parallel](https://nvidia.github.io/cccl/cuda_parallel/): A Python package providing CUB's reusable block-wide and warp-wide primitives for use within Numba CUDA kernels
99

1010
For access to NVIDIA CPU & GPU Math Libraries, please refer to [nvmath-python](https://docs.nvidia.com/cuda/nvmath-python/latest).
1111

cuda_bindings/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ recursive-include cuda/ *.pyx *.pxd
22
# at least with setuptools 75.0.0 this folder was added erroneously
33
# to the payload, causing file copying to the build environment failed
44
exclude cuda/bindings cuda?bindings
5+
exclude cuda/bindings/_bindings cuda?bindings?_bindings

cuda_bindings/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ To run these samples:
9595
* `python -m pytest tests/cython/` against editable installations
9696
* `pytest tests/cython/` against installed packages
9797

98-
### Benchmark (WIP)
98+
### Benchmark
9999

100-
Benchmarks were used for performance analysis during initial release of CUDA Python. Today they need to be updated the 12.x toolkit and are work in progress.
100+
Allows for analyzing binding performance using plugin [pytest-benchmark](https://github.com/ionelmc/pytest-benchmark).
101101

102-
The intended way to run these benchmarks was:
103-
* `python -m pytest --benchmark-only benchmark/` against editable installations
104-
* `pytest --benchmark-only benchmark/` against installed packages
102+
To run these benchmarks:
103+
* `python -m pytest --benchmark-only benchmarks/` against editable installations
104+
* `pytest --benchmark-only benchmarks/` against installed packages

cuda_bindings/benchmarks/__init__.py

Whitespace-only changes.

cuda_bindings/benchmarks/perf_test_utils.py renamed to cuda_bindings/benchmarks/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021-2024 NVIDIA Corporation. All rights reserved.
1+
# Copyright 2021-2025 NVIDIA Corporation. All rights reserved.
22
#
33
# Please refer to the NVIDIA end user license agreement (EULA) associated
44
# with this source code for terms and conditions that govern your use of
@@ -25,7 +25,7 @@ def ASSERT_DRV(err):
2525
raise RuntimeError(f"Unknown error type: {err}")
2626

2727

28-
@pytest.fixture
28+
@pytest.fixture(scope="function")
2929
def init_cuda():
3030
# Initialize
3131
(err,) = cuda.cuInit(0)
@@ -47,7 +47,7 @@ def init_cuda():
4747
ASSERT_DRV(err)
4848

4949

50-
@pytest.fixture
50+
@pytest.fixture(scope="function")
5151
def load_module():
5252
module = None
5353

cuda_bindings/benchmarks/kernels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2021-2024 NVIDIA Corporation. All rights reserved.
1+
# Copyright 2021-2025 NVIDIA Corporation. All rights reserved.
22
#
33
# Please refer to the NVIDIA end user license agreement (EULA) associated
44
# with this source code for terms and conditions that govern your use of

0 commit comments

Comments
 (0)