Skip to content

Commit a7d8c64

Browse files
committed
Restructure graph/ subpackage to use __all__ and star imports
Add __all__ to each graph submodule and rewrite graph/__init__.py to use 'from ._module import *' pattern, matching the convention already used by _memory/ and system/ subpackages. - _graph_builder.pyx: __all__ = Graph, GraphBuilder, GraphCompleteOptions, GraphDebugPrintOptions - _graph_def.pyx: __all__ = Condition, GraphAllocOptions, GraphDef - _graph_node.pyx: __all__ = GraphNode - _subclasses.pyx: __all__ = all 15 node subclasses - __init__.py: replaced explicit named imports with star imports
1 parent b991295 commit a7d8c64

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

cuda_core/cuda/core/graph/__init__.py

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from cuda.core.graph._graph_builder import (
6-
Graph,
7-
GraphBuilder,
8-
GraphCompleteOptions,
9-
GraphDebugPrintOptions,
10-
)
11-
from cuda.core.graph._graph_def import (
12-
Condition,
13-
GraphAllocOptions,
14-
GraphDef,
15-
)
16-
from cuda.core.graph._graph_node import GraphNode
17-
from cuda.core.graph._subclasses import (
18-
AllocNode,
19-
ChildGraphNode,
20-
ConditionalNode,
21-
EmptyNode,
22-
EventRecordNode,
23-
EventWaitNode,
24-
FreeNode,
25-
HostCallbackNode,
26-
IfElseNode,
27-
IfNode,
28-
KernelNode,
29-
MemcpyNode,
30-
MemsetNode,
31-
SwitchNode,
32-
WhileNode,
33-
)
5+
from ._graph_builder import *
6+
from ._graph_def import *
7+
from ._graph_node import *
8+
from ._subclasses import *

cuda_core/cuda/core/graph/_graph_builder.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ from cuda.core._utils.cuda_utils import (
2121
handle_return,
2222
)
2323

24+
__all__ = ['Graph', 'GraphBuilder', 'GraphCompleteOptions', 'GraphDebugPrintOptions']
25+
26+
2427
@dataclass
2528
class GraphDebugPrintOptions:
2629
"""Options for debug_dot_print().

cuda_core/cuda/core/graph/_graph_def.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ from dataclasses import dataclass
2727

2828
from cuda.core._utils.cuda_utils import driver
2929

30+
__all__ = ['Condition', 'GraphAllocOptions', 'GraphDef']
31+
3032

3133
cdef class Condition:
3234
"""A condition variable for conditional graph nodes.

cuda_core/cuda/core/graph/_graph_node.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ import weakref
6161
from cuda.core.graph._adjacency_set_proxy import AdjacencySetProxy
6262
from cuda.core._utils.cuda_utils import driver
6363

64+
__all__ = ['GraphNode']
65+
6466
# See _cpp/REGISTRY_DESIGN.md (Level 2: Resource Handle -> Python Object)
6567
_node_registry = weakref.WeakValueDictionary()
6668

cuda_core/cuda/core/graph/_subclasses.pyx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ from cuda.core.graph._utils cimport _is_py_host_trampoline
3434

3535
from cuda.core._utils.cuda_utils import driver, handle_return
3636

37+
__all__ = [
38+
'AllocNode',
39+
'ChildGraphNode',
40+
'ConditionalNode',
41+
'EmptyNode',
42+
'EventRecordNode',
43+
'EventWaitNode',
44+
'FreeNode',
45+
'HostCallbackNode',
46+
'IfElseNode',
47+
'IfNode',
48+
'KernelNode',
49+
'MemcpyNode',
50+
'MemsetNode',
51+
'SwitchNode',
52+
'WhileNode',
53+
]
54+
3755

3856
cdef bint _has_cuGraphNodeGetParams = False
3957
cdef bint _version_checked = False

0 commit comments

Comments
 (0)