Skip to content

Commit d4418b3

Browse files
authored
Merge pull request #258 from ksimpson-work/link_doc_references
Make the link to different object types explicit for the docs
2 parents 4ad4042 + 6076e95 commit d4418b3

File tree

7 files changed

+49
-49
lines changed

7 files changed

+49
-49
lines changed

cuda_core/cuda/core/experimental/_device.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class Device:
2323
and use the same GPU device.
2424
2525
While acting as the entry point, many other CUDA resources can be
26-
allocated such as streams and buffers. Any :obj:`Context` dependent
26+
allocated such as streams and buffers. Any :obj:`~_context.Context` dependent
2727
resource created through this device, will continue to refer to
2828
this device's context.
2929
30-
Newly returend :obj:`Device` object are is a thread-local singleton
30+
Newly returned :obj:`~_device.Device` objects are thread-local singletons
3131
for a specified device.
3232
3333
Note
@@ -37,7 +37,7 @@ class Device:
3737
Parameters
3838
----------
3939
device_id : int, optional
40-
Device ordinal to return a :obj:`Device` object for.
40+
Device ordinal to return a :obj:`~_device.Device` object for.
4141
Default value of `None` return the currently used device.
4242
4343
"""
@@ -144,7 +144,7 @@ def compute_capability(self) -> ComputeCapability:
144144
@property
145145
@precondition(_check_context_initialized)
146146
def context(self) -> Context:
147-
"""Return the current :obj:`Context` associated with this device.
147+
"""Return the current :obj:`~_context.Context` associated with this device.
148148
149149
Note
150150
----
@@ -157,7 +157,7 @@ def context(self) -> Context:
157157

158158
@property
159159
def memory_resource(self) -> MemoryResource:
160-
"""Return :obj:`MemoryResource` associated with this device."""
160+
"""Return :obj:`~_memory.MemoryResource` associated with this device."""
161161
return self._mr
162162

163163
@memory_resource.setter
@@ -168,7 +168,7 @@ def memory_resource(self, mr):
168168

169169
@property
170170
def default_stream(self) -> Stream:
171-
"""Return default CUDA :obj:`Stream` associated with this device.
171+
"""Return default CUDA :obj:`~_stream.Stream` associated with this device.
172172
173173
The type of default stream returned depends on if the environment
174174
variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set.
@@ -191,18 +191,18 @@ def set_current(self, ctx: Context = None) -> Union[Context, None]:
191191
192192
Initializes CUDA and sets the calling thread to a valid CUDA
193193
context. By default the primary context is used, but optional `ctx`
194-
parameter can be used to explicitly supply a :obj:`Context` object.
194+
parameter can be used to explicitly supply a :obj:`~_context.Context` object.
195195
196196
Providing a `ctx` causes the previous set context to be popped and returned.
197197
198198
Parameters
199199
----------
200-
ctx : :obj:`Context`, optional
200+
ctx : :obj:`~_context.Context`, optional
201201
Optional context to push onto this device's current thread stack.
202202
203203
Returns
204204
-------
205-
Union[:obj:`Context`, None], optional
205+
Union[:obj:`~_context.Context`, None], optional
206206
Popped context.
207207
208208
Examples
@@ -247,20 +247,20 @@ def set_current(self, ctx: Context = None) -> Union[Context, None]:
247247
self._has_inited = True
248248

249249
def create_context(self, options: ContextOptions = None) -> Context:
250-
"""Create a new :obj:`Context` object.
250+
"""Create a new :obj:`~_context.Context` object.
251251
252252
Note
253253
----
254254
The newly context will not be set as current.
255255
256256
Parameters
257257
----------
258-
options : :obj:`ContextOptions`, optional
258+
options : :obj:`~_context.ContextOptions`, optional
259259
Customizable dataclass for context creation options.
260260
261261
Returns
262262
-------
263-
:obj:`Context`
263+
:obj:`~_context.Context`
264264
Newly created context object.
265265
266266
"""
@@ -286,12 +286,12 @@ def create_stream(self, obj=None, options: StreamOptions = None) -> Stream:
286286
----------
287287
obj : Any, optional
288288
Any object supporting the __cuda_stream__ protocol.
289-
options : :obj:`StreamOptions`, optional
289+
options : :obj:`~_stream.StreamOptions`, optional
290290
Customizable dataclass for stream creation options.
291291
292292
Returns
293293
-------
294-
:obj:`Stream`
294+
:obj:`~_stream.Stream`
295295
Newly created stream object.
296296
297297
"""
@@ -314,13 +314,13 @@ def allocate(self, size, stream=None) -> Buffer:
314314
----------
315315
size : int
316316
Number of bytes to allocate.
317-
stream : :obj:`Stream`, optional
317+
stream : :obj:`~_stream.Stream`, optional
318318
The stream establishing the stream ordering semantic.
319319
Default value of `None` uses default stream.
320320
321321
Returns
322322
-------
323-
:obj:`Buffer`
323+
:obj:`~_memory.Buffer`
324324
Newly created buffer object.
325325
326326
"""

cuda_core/cuda/core/experimental/_event.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@dataclass
1414
class EventOptions:
15-
"""Customizable :obj:`Event` options.
15+
"""Customizable :obj:`~_event.Event` options.
1616
1717
Attributes
1818
----------
@@ -46,8 +46,8 @@ class Event:
4646
of work up to event's record, and help establish dependencies
4747
between GPU work submissions.
4848
49-
Directly creating an :obj:`Event` is not supported due to ambiguity,
50-
and they should instead be created through a :obj:`Stream` object.
49+
Directly creating an :obj:`~_event.Event` is not supported due to ambiguity,
50+
and they should instead be created through a :obj:`~_stream.Stream` object.
5151
5252
"""
5353

cuda_core/cuda/core/experimental/_launcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class LaunchConfig:
4747
Group of threads (Thread Block) that will execute on the same
4848
streaming multiprocessor (SM). Threads within a thread blocks have
4949
access to shared memory and can be explicitly synchronized.
50-
stream : :obj:`Stream`
50+
stream : :obj:`~_stream.Stream`
5151
The stream establishing the stream ordering semantic of a
5252
launch.
5353
shmem_size : int, optional
@@ -108,16 +108,16 @@ def _cast_to_3_tuple(self, cfg):
108108

109109

110110
def launch(kernel, config, *kernel_args):
111-
"""Launches a :obj:`~cuda.core.experimental._module.Kernel`
111+
"""Launches a :obj:`~_module.Kernel`
112112
object with launch-time configuration.
113113
114114
Parameters
115115
----------
116-
kernel : :obj:`~cuda.core.experimental._module.Kernel`
116+
kernel : :obj:`~_module.Kernel`
117117
Kernel to launch.
118-
config : :obj:`LaunchConfig`
118+
config : :obj:`~_launcher.LaunchConfig`
119119
Launch configurations inline with options provided by
120-
:obj:`LaunchConfig` dataclass.
120+
:obj:`~_launcher.LaunchConfig` dataclass.
121121
*kernel_args : Any
122122
Variable length argument list that is provided to the
123123
launching kernel.

cuda_core/cuda/core/experimental/_memory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Buffer:
3737
Allocated buffer handle object
3838
size : Any
3939
Memory size of the buffer
40-
mr : :obj:`MemoryResource`, optional
40+
mr : :obj:`~_memory.MemoryResource`, optional
4141
Memory resource associated with the buffer
4242
4343
"""
@@ -126,7 +126,7 @@ def copy_to(self, dst: Buffer = None, *, stream) -> Buffer:
126126
127127
Parameters
128128
----------
129-
dst : :obj:`Buffer`
129+
dst : :obj:`~_memory.Buffer`
130130
Source buffer to copy data from
131131
stream : Any
132132
Keyword argument specifying the stream for the
@@ -149,7 +149,7 @@ def copy_from(self, src: Buffer, *, stream):
149149
150150
Parameters
151151
----------
152-
src : :obj:`Buffer`
152+
src : :obj:`~_memory.Buffer`
153153
Source buffer to copy data from
154154
stream : Any
155155
Keyword argument specifying the stream for the

cuda_core/cuda/core/experimental/_module.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class Kernel:
4848
"""Represent a compiled kernel that had been loaded onto the device.
4949
5050
Kernel instances can execution when passed directly into the
51-
:func:`~cuda.core.experimental.launch` function.
51+
:func:`~launch` function.
5252
53-
Directly creating a :obj:`Kernel` is not supported, and they
54-
should instead be created through a :obj:`ObjectCode` object.
53+
Directly creating a :obj:`~_module.Kernel` is not supported, and they
54+
should instead be created through a :obj:`~_module.ObjectCode` object.
5555
5656
"""
5757

@@ -164,7 +164,7 @@ def _lazy_load_module(self, *args, **kwargs):
164164

165165
@precondition(_lazy_load_module)
166166
def get_kernel(self, name):
167-
"""Return the :obj:`Kernel` of a specified name from this object code.
167+
"""Return the :obj:`~_module.Kernel` of a specified name from this object code.
168168
169169
Parameters
170170
----------
@@ -173,7 +173,7 @@ def get_kernel(self, name):
173173
174174
Returns
175175
-------
176-
:obj:`Kernel`
176+
:obj:`~_module.Kernel`
177177
Newly created kernel object.
178178
179179
"""

cuda_core/cuda/core/experimental/_program.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Program:
1313
"""Represent a compilation machinery to process programs into
14-
:obj:`~cuda.core.experimental._module.ObjectCode`.
14+
:obj:`~_module.ObjectCode`.
1515
1616
This object provides a unified interface to multiple underlying
1717
compiler libraries. Compilation support is enabled for a wide
@@ -72,7 +72,7 @@ def compile(self, target_type, options=(), name_expressions=(), logs=None):
7272
Supported options are "ptx", "cubin" and "ltoir".
7373
options : Union[List, Tuple], optional
7474
List of compilation options associated with the backend
75-
of this :obj:`Program`. (Default to no options)
75+
of this :obj:`~_program.Program`. (Default to no options)
7676
name_expressions : Union[List, Tuple], optional
7777
List of explicit name expressions to become accessible.
7878
(Default to no expressions)
@@ -83,7 +83,7 @@ def compile(self, target_type, options=(), name_expressions=(), logs=None):
8383
8484
Returns
8585
-------
86-
:obj:`~cuda.core.experimental._module.ObjectCode`
86+
:obj:`~_module.ObjectCode`
8787
Newly created code object.
8888
8989
"""

cuda_core/cuda/core/experimental/_stream.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
@dataclass
2121
class StreamOptions:
22-
"""Customizable :obj:`Stream` options.
22+
"""Customizable :obj:`~_stream.Stream` options.
2323
2424
Attributes
2525
----------
@@ -41,13 +41,13 @@ class Stream:
4141
Applications use streams to control the order of execution for
4242
GPU work. Work within a single stream are executed sequentially.
4343
Whereas work across multiple streams can be further controlled
44-
using stream priorities and :obj:`Event` managements.
44+
using stream priorities and :obj:`~_event.Event` managements.
4545
4646
Advanced users can utilize default streams for enforce complex
4747
implicit synchronization behaviors.
4848
49-
Directly creating a :obj:`Stream` is not supported due to ambiguity.
50-
New streams should instead be created through a :obj:`Device`
49+
Directly creating a :obj:`~_stream.Stream` is not supported due to ambiguity.
50+
New streams should instead be created through a :obj:`~_device.Device`
5151
object, or created directly through using an existing handle
5252
using Stream.from_handle().
5353
@@ -173,14 +173,14 @@ def record(self, event: Event = None, options: EventOptions = None) -> Event:
173173
174174
Parameters
175175
----------
176-
event : :obj:`Event`, optional
176+
event : :obj:`~_event.Event`, optional
177177
Optional event object to be reused for recording.
178178
options : :obj:`EventOptions`, optional
179179
Customizable dataclass for event creation options.
180180
181181
Returns
182182
-------
183-
:obj:`Event`
183+
:obj:`~_event.Event`
184184
Newly created event object.
185185
186186
"""
@@ -199,8 +199,8 @@ def wait(self, event_or_stream: Union[Event, Stream]):
199199
200200
Waiting for an event or a stream establishes a stream order.
201201
202-
If a :obj:`Stream` is provided, then wait until the stream's
203-
work is completed. This is done by recording a new :obj:`Event`
202+
If a :obj:`~_stream.Stream` is provided, then wait until the stream's
203+
work is completed. This is done by recording a new :obj:`~_event.Event`
204204
on the stream and then waiting on it.
205205
206206
"""
@@ -226,7 +226,7 @@ def wait(self, event_or_stream: Union[Event, Stream]):
226226

227227
@property
228228
def device(self) -> Device:
229-
"""Return the :obj:`Device` singleton associated with this stream.
229+
"""Return the :obj:`~_device.Device` singleton associated with this stream.
230230
231231
Note
232232
----
@@ -246,7 +246,7 @@ def device(self) -> Device:
246246

247247
@property
248248
def context(self) -> Context:
249-
"""Return the :obj:`Context` associated with this stream."""
249+
"""Return the :obj:`~_context.Context` associated with this stream."""
250250
if self._ctx_handle is None:
251251
self._ctx_handle = handle_return(cuda.cuStreamGetCtx(self._mnff.handle))
252252
if self._device_id is None:
@@ -255,10 +255,10 @@ def context(self) -> Context:
255255

256256
@staticmethod
257257
def from_handle(handle: int) -> Stream:
258-
"""Create a new :obj:`Stream` object from a foreign stream handle.
258+
"""Create a new :obj:`~_stream.Stream` object from a foreign stream handle.
259259
260260
Uses a cudaStream_t pointer address represented as a Python int
261-
to create a new :obj:`Stream` object.
261+
to create a new :obj:`~_stream.Stream` object.
262262
263263
Note
264264
----
@@ -273,7 +273,7 @@ def from_handle(handle: int) -> Stream:
273273
274274
Returns
275275
-------
276-
:obj:`Stream`
276+
:obj:`~_stream.Stream`
277277
Newly created stream object.
278278
279279
"""
@@ -305,7 +305,7 @@ def __init__(self):
305305

306306

307307
def default_stream():
308-
"""Return the default CUDA :obj:`Stream`.
308+
"""Return the default CUDA :obj:`~_stream.Stream`.
309309
310310
The type of default stream returned depends on if the environment
311311
variable CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM is set.

0 commit comments

Comments
 (0)