Skip to content

Commit 8bdec20

Browse files
committed
Merge branch 'main' into clearer_error_messages
2 parents bf3c776 + 02a4178 commit 8bdec20

File tree

8 files changed

+22
-27
lines changed

8 files changed

+22
-27
lines changed

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

cuda_bindings/benchmarks/test_cupy.py

Lines changed: 7 additions & 10 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
@@ -9,17 +9,14 @@
99

1010
import pytest
1111

12-
# Always skip since cupy is not CTK 12.x yet
13-
skip_tests = True
14-
if not skip_tests:
15-
try:
16-
import cupy
12+
try:
13+
import cupy
1714

18-
skip_tests = False
19-
except ImportError:
20-
skip_tests = True
15+
skip_tests = False
16+
except ImportError:
17+
skip_tests = True
2118

22-
from .kernels import kernel_string
19+
from kernels import kernel_string
2320

2421

2522
def launch(kernel, args=()):

cuda_bindings/benchmarks/test_launch_latency.py

Lines changed: 3 additions & 4 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
@@ -8,12 +8,11 @@
88
import ctypes
99

1010
import pytest
11+
from conftest import ASSERT_DRV
12+
from kernels import kernel_string
1113

1214
from cuda import cuda
1315

14-
from .kernels import kernel_string
15-
from .perf_test_utils import ASSERT_DRV
16-
1716

1817
def launch(kernel, stream, args=(), arg_types=()):
1918
cuda.cuLaunchKernel(

cuda_bindings/benchmarks/test_numba.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

cuda_bindings/benchmarks/test_pointer_attributes.py

Lines changed: 2 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
@@ -8,11 +8,10 @@
88
import random
99

1010
import pytest
11+
from conftest import ASSERT_DRV
1112

1213
from cuda import cuda
1314

14-
from .perf_test_utils import ASSERT_DRV
15-
1615
random.seed(0)
1716

1817
idx = 0

0 commit comments

Comments
 (0)