Skip to content

Commit d6afedf

Browse files
authored
Merge pull request #398 from ksimpson-work/documentation-remove-gpu-dependency
Documentation remove gpu dependency
2 parents 789e3d4 + 914d179 commit d6afedf

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

cuda_core/cuda/core/experimental/_memoryview.pyx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ cdef class StridedMemoryView:
4848
----------
4949
ptr : int
5050
Pointer to the tensor buffer (as a Python `int`).
51-
shape: tuple
51+
shape : tuple
5252
Shape of the tensor.
53-
strides: tuple
53+
strides : tuple
5454
Strides of the tensor (in **counts**, not bytes).
5555
dtype: numpy.dtype
5656
Data type of the tensor.
57-
device_id: int
57+
device_id : int
5858
The device ID for where the tensor is located. It is -1 for CPU tensors
5959
(meaning those only accessible from the host).
60-
is_device_accessible: bool
60+
is_device_accessible : bool
6161
Whether the tensor data can be accessed on the GPU.
6262
readonly: bool
6363
Whether the tensor data can be modified in place.
64-
exporting_obj: Any
64+
exporting_obj : Any
6565
A reference to the original tensor object that is being viewed.
6666
6767
Parameters
@@ -334,7 +334,8 @@ cdef StridedMemoryView view_as_cai(obj, stream_ptr, view=None):
334334

335335

336336
def args_viewable_as_strided_memory(tuple arg_indices):
337-
"""Decorator to create proxy objects to :obj:`StridedMemoryView` for the
337+
"""
338+
Decorator to create proxy objects to :obj:`StridedMemoryView` for the
338339
specified positional arguments.
339340
340341
This allows array/tensor attributes to be accessed inside the function

cuda_core/docs/source/conf.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
import os
13+
import sys
14+
from unittest.mock import MagicMock
15+
16+
from cuda.core.experimental._system import System
1317

14-
# import sys
1518
# sys.path.insert(0, os.path.abspath('.'))
1619

1720

@@ -102,6 +105,24 @@
102105
napoleon_numpy_docstring = True
103106

104107

108+
# Mock the System class and its methods
109+
class MockSystem:
110+
def __init__(self, *args, **kwargs):
111+
pass
112+
113+
driver_version = MagicMock()
114+
driver_version.__doc__ = System.driver_version.__doc__
115+
num_devices = MagicMock()
116+
num_devices.__doc__ = System.num_devices.__doc__
117+
devices = MagicMock()
118+
devices.__doc__ = System.devices.__doc__
119+
120+
121+
sys.modules["cuda.core.experimental._system.System"] = MagicMock(System=MockSystem)
122+
123+
# Add 'cuda.core.experimental.system' to autodoc_mock_imports
124+
autodoc_mock_imports = ["cuda.core.experimental.system"]
125+
105126
section_titles = ["Returns"]
106127

107128

0 commit comments

Comments
 (0)