Skip to content

Commit 9aebc85

Browse files
leofangmdboom
andauthored
Prepare for cuda.core v0.4.2 (#1254)
* avoid triggering module-level delattr * allow building/testing on release branches * use default fetch-depth (1) to accelerate checkout * Fix #1051: Make _graph.py compatible with cuda-python==12.6.* and fix tests --------- Co-authored-by: Michael Droettboom <mdboom@gmail.com>
1 parent 453577d commit 9aebc85

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
branches:
1616
- "pull-request/[0-9]+"
1717
- "main"
18+
- "release/*"
1819

1920
jobs:
2021
ci-vars:

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ jobs:
3636
steps:
3737
- name: Checkout ${{ github.event.repository.name }}
3838
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39-
with:
40-
fetch-depth: 1
4139

4240
- name: Validate Test Type
4341
run: |
@@ -97,8 +95,6 @@ jobs:
9795

9896
- name: Checkout ${{ github.event.repository.name }}
9997
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
100-
with:
101-
fetch-depth: 0
10298

10399
- name: Setup proxy cache
104100
uses: nv-gha-runners/setup-proxy-cache@main

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ jobs:
3434
steps:
3535
- name: Checkout ${{ github.event.repository.name }}
3636
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37-
with:
38-
fetch-depth: 1
3937

4038
- name: Validate Test Type
4139
run: |
@@ -76,8 +74,6 @@ jobs:
7674
steps:
7775
- name: Checkout ${{ github.event.repository.name }}
7876
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
79-
with:
80-
fetch-depth: 0
8177

8278
- name: Setup proxy cache
8379
uses: nv-gha-runners/setup-proxy-cache@main

cuda_core/cuda/core/experimental/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
try:
6-
import cuda.bindings
6+
from cuda import bindings
77
except ImportError:
88
raise ImportError("cuda.bindings 12.x or 13.x must be installed") from None
99
else:
10-
cuda_major, cuda_minor = cuda.bindings.__version__.split(".")[:2]
10+
cuda_major, cuda_minor = bindings.__version__.split(".")[:2]
1111
if cuda_major not in ("12", "13"):
1212
raise ImportError("cuda.bindings 12.x or 13.x must be installed")
1313

@@ -24,7 +24,7 @@
2424
else:
2525
del versioned_mod
2626
finally:
27-
del cuda.bindings, importlib, subdir, cuda_major, cuda_minor
27+
del bindings, importlib, subdir, cuda_major, cuda_minor
2828

2929
import sys # noqa: E402
3030
import warnings # noqa: E402

cuda_core/cuda/core/experimental/_graph.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,10 @@ def complete(self, options: GraphCompleteOptions | None = None) -> Graph:
318318
raise RuntimeError(
319319
"Instantiation for device launch failed due to the nodes belonging to different contexts."
320320
)
321-
elif params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED:
321+
elif (
322+
_py_major_minor >= (12, 8)
323+
and params.result_out == driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_CONDITIONAL_HANDLE_UNUSED
324+
):
322325
raise RuntimeError("One or more conditional handles are not associated with conditional builders.")
323326
elif params.result_out != driver.CUgraphInstantiateResult.CUDA_GRAPH_INSTANTIATE_SUCCESS:
324327
raise RuntimeError(f"Graph instantiation failed with unexpected error code: {params.result_out}")

cuda_core/tests/test_graph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_graph_conditional_if_else(init_cuda, condition_value):
304304
try:
305305
gb_if, gb_else = gb.if_else(handle)
306306
except RuntimeError as e:
307-
with pytest.raises(RuntimeError, match="^Driver version"):
307+
with pytest.raises(RuntimeError, match="^(Driver|Binding) version"):
308308
raise e
309309
gb.end_building()
310310
b.close()
@@ -377,7 +377,7 @@ def test_graph_conditional_switch(init_cuda, condition_value):
377377
try:
378378
gb_case = list(gb.switch(handle, 3))
379379
except RuntimeError as e:
380-
with pytest.raises(RuntimeError, match="^Driver version"):
380+
with pytest.raises(RuntimeError, match="^(Driver|Binding) version"):
381381
raise e
382382
gb.end_building()
383383
b.close()
@@ -568,7 +568,7 @@ def build_graph(condition_value):
568568
try:
569569
gb_case = list(gb.switch(handle, 3))
570570
except Exception as e:
571-
with pytest.raises(RuntimeError, match="^Driver version"):
571+
with pytest.raises(RuntimeError, match="^(Driver|Binding) version"):
572572
raise e
573573
gb.end_building()
574574
raise e
@@ -599,7 +599,7 @@ def build_graph(condition_value):
599599
try:
600600
graph_variants = [build_graph(0), build_graph(1), build_graph(2)]
601601
except Exception as e:
602-
with pytest.raises(RuntimeError, match="^Driver version"):
602+
with pytest.raises(RuntimeError, match="^(Driver|Binding) version"):
603603
raise e
604604
b.close()
605605
pytest.skip("Driver does not support conditional switch")

0 commit comments

Comments
 (0)