Skip to content

Commit 80f4f30

Browse files
Merge pull request #1593 from IntelPython/address-sphinx-errors
Address sphinx errors
2 parents 4be843a + f9a3e1b commit 80f4f30

File tree

8 files changed

+126
-86
lines changed

8 files changed

+126
-86
lines changed

dpctl/_sycl_device.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ cdef class SyclDevice(_SyclDevice):
503503
504504
Indicates that the device supports the following atomic operations on
505505
64-bit values:
506+
506507
- atomic::load
507508
- atomic::store
508509
- atomic::fetch_add

dpctl/memory/_memory.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class USMAllocationError(Exception):
8383
An exception raised when Universal Shared Memory (USM) allocation
8484
call returns a null pointer, signaling a failure to perform the allocation.
8585
Some common reasons for allocation failure are:
86+
8687
* insufficient free memory to perform the allocation request
8788
* allocation size exceeds the maximum supported by targeted backend
8889
"""

dpctl/tensor/_linear_algebra_functions.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ def tensordot(x1, x2, axes=2):
8181
then the contraction is performed over last `N` axes of `x1` and
8282
the first `N` axis of `x2` in order. The size of each corresponding
8383
axis must match and must be non-negative.
84-
* if `N` equals `0`, the result is the tensor outer product
85-
* if `N` equals `1`, the result is the tensor dot product
86-
* if `N` equals `2`, the result is the tensor double
87-
contraction (default).
84+
85+
* if `N` equals `0`, the result is the tensor outer product
86+
* if `N` equals `1`, the result is the tensor dot product
87+
* if `N` equals `2`, the result is the tensor double
88+
contraction (default).
8889
If `axes` is a tuple of two sequences `(x1_axes, x2_axes)`, the
8990
first sequence applies to `x1` and the second sequence applies
9091
to `x2`. Both sequences must have equal length, and each axis

dpctl/tensor/_print.py

Lines changed: 82 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -116,50 +116,61 @@ def set_print_options(
116116
Set options for printing :class:`dpctl.tensor.usm_ndarray` class.
117117
118118
Args:
119-
linewidth (int, optional): Number of characters printed per line.
119+
linewidth (int, optional):
120+
Number of characters printed per line.
120121
Raises `TypeError` if linewidth is not an integer.
121122
Default: `75`.
122-
edgeitems (int, optional): Number of elements at the beginning and end
123+
edgeitems (int, optional):
124+
Number of elements at the beginning and end
123125
when the printed array is abbreviated.
124126
Raises `TypeError` if edgeitems is not an integer.
125127
Default: `3`.
126-
threshold (int, optional): Number of elements that triggers array
127-
abbreviation.
128+
threshold (int, optional):
129+
Number of elements that triggers array abbreviation.
128130
Raises `TypeError` if threshold is not an integer.
129131
Default: `1000`.
130-
precision (int or None, optional): Number of digits printed for
131-
floating point numbers.
132+
precision (int or None, optional):
133+
Number of digits printed for floating point numbers.
132134
Raises `TypeError` if precision is not an integer.
133135
Default: `8`.
134-
floatmode (str, optional): Controls how floating point
135-
numbers are interpreted.
136-
137-
`"fixed:`: Always prints exactly `precision` digits.
138-
`"unique"`: Ignores precision, prints the number of
139-
digits necessary to uniquely specify each number.
140-
`"maxprec"`: Prints `precision` digits or fewer,
141-
if fewer will uniquely represent a number.
142-
`"maxprec_equal"`: Prints an equal number of digits
143-
for each number. This number is `precision` digits or fewer,
144-
if fewer will uniquely represent each number.
136+
floatmode (str, optional):
137+
Controls how floating point numbers are interpreted.
138+
`"fixed:`:
139+
Always prints exactly `precision` digits.
140+
`"unique"`:
141+
Ignores precision, prints the number of
142+
digits necessary to uniquely specify each number.
143+
`"maxprec"`:
144+
Prints `precision` digits or fewer,
145+
if fewer will uniquely represent a number.
146+
`"maxprec_equal"`:
147+
Prints an equal number of digits
148+
for each number. This number is `precision` digits
149+
or fewer, if fewer will uniquely represent each number.
145150
Raises `ValueError` if floatmode is not one of
146151
`fixed`, `unique`, `maxprec`, or `maxprec_equal`.
147152
Default: "maxprec_equal"
148-
suppress (bool, optional): If `True,` numbers equal to zero
149-
in the current precision will print as zero.
153+
suppress (bool, optional):
154+
If `True,` numbers equal to zero in the current precision
155+
will print as zero.
150156
Default: `False`.
151-
nanstr (str, optional): String used to represent nan.
157+
nanstr (str, optional):
158+
String used to represent nan.
152159
Raises `TypeError` if nanstr is not a string.
153160
Default: `"nan"`.
154-
infstr (str, optional): String used to represent infinity.
161+
infstr (str, optional):
162+
String used to represent infinity.
155163
Raises `TypeError` if infstr is not a string.
156164
Default: `"inf"`.
157-
sign (str, optional): Controls the sign of floating point
158-
numbers.
159-
`"-"`: Omit the sign of positive numbers.
160-
`"+"`: Always print the sign of positive numbers.
161-
`" "`: Always print a whitespace in place of the
162-
sign of positive numbers.
165+
sign (str, optional):
166+
Controls the sign of floating point numbers.
167+
`"-"`:
168+
Omit the sign of positive numbers.
169+
`"+"`:
170+
Always print the sign of positive numbers.
171+
`" "`:
172+
Always print a whitespace in place of the
173+
sign of positive numbers.
163174
Raises `ValueError` if sign is not one of
164175
`"-"`, `"+"`, or `" "`.
165176
Default: `"-"`.
@@ -287,60 +298,71 @@ def usm_ndarray_str(
287298
:class:`dpctl.tensor.usm_ndarray`.
288299
289300
Args:
290-
x (usm_ndarray): Input array.
291-
line_width (int, optional): Number of characters printed per line.
301+
x (usm_ndarray):
302+
Input array.
303+
line_width (int, optional):
304+
Number of characters printed per line.
292305
Raises `TypeError` if line_width is not an integer.
293306
Default: `75`.
294-
edgeitems (int, optional): Number of elements at the beginning and end
307+
edgeitems (int, optional):
308+
Number of elements at the beginning and end
295309
when the printed array is abbreviated.
296310
Raises `TypeError` if edgeitems is not an integer.
297311
Default: `3`.
298-
threshold (int, optional): Number of elements that triggers array
299-
abbreviation.
312+
threshold (int, optional):
313+
Number of elements that triggers array abbreviation.
300314
Raises `TypeError` if threshold is not an integer.
301315
Default: `1000`.
302-
precision (int or None, optional): Number of digits printed for
303-
floating point numbers.
316+
precision (int or None, optional):
317+
Number of digits printed for floating point numbers.
304318
Raises `TypeError` if precision is not an integer.
305319
Default: `8`.
306-
floatmode (str, optional): Controls how floating point
307-
numbers are interpreted.
308-
309-
`"fixed:`: Always prints exactly `precision` digits.
310-
`"unique"`: Ignores precision, prints the number of
311-
digits necessary to uniquely specify each number.
312-
`"maxprec"`: Prints `precision` digits or fewer,
313-
if fewer will uniquely represent a number.
314-
`"maxprec_equal"`: Prints an equal number of digits
315-
for each number. This number is `precision` digits or fewer,
316-
if fewer will uniquely represent each number.
320+
floatmode (str, optional):
321+
Controls how floating point numbers are interpreted.
322+
`"fixed:`:
323+
Always prints exactly `precision` digits.
324+
`"unique"`:
325+
Ignores precision, prints the number of
326+
digits necessary to uniquely specify each number.
327+
`"maxprec"`:
328+
Prints `precision` digits or fewer,
329+
if fewer will uniquely represent a number.
330+
`"maxprec_equal"`:
331+
Prints an equal number of digits for each number.
332+
This number is `precision` digits or fewer,
333+
if fewer will uniquely represent each number.
317334
Raises `ValueError` if floatmode is not one of
318335
`fixed`, `unique`, `maxprec`, or `maxprec_equal`.
319336
Default: "maxprec_equal"
320-
suppress (bool, optional): If `True,` numbers equal to zero
321-
in the current precision will print as zero.
337+
suppress (bool, optional):
338+
If `True,` numbers equal to zero in the current precision
339+
will print as zero.
322340
Default: `False`.
323-
sign (str, optional): Controls the sign of floating point
324-
numbers.
325-
`"-"`: Omit the sign of positive numbers.
326-
`"+"`: Always print the sign of positive numbers.
327-
`" "`: Always print a whitespace in place of the
328-
sign of positive numbers.
341+
sign (str, optional):
342+
Controls the sign of floating point numbers.
343+
`"-"`:
344+
Omit the sign of positive numbers.
345+
`"+"`:
346+
Always print the sign of positive numbers.
347+
`" "`:
348+
Always print a whitespace in place of the
349+
sign of positive numbers.
329350
Raises `ValueError` if sign is not one of
330351
`"-"`, `"+"`, or `" "`.
331352
Default: `"-"`.
332-
numpy (bool, optional): If `True,` then before other specified print
353+
numpy (bool, optional):
354+
If `True,` then before other specified print
333355
options are set, a dictionary of Numpy's print options
334356
will be used to initialize dpctl's print options.
335357
Default: "False"
336-
separator (str, optional): String inserted between elements of
337-
the array string.
358+
separator (str, optional):
359+
String inserted between elements of the array string.
338360
Default: " "
339-
prefix (str, optional): String used to determine spacing to the left
340-
of the array string.
361+
prefix (str, optional):
362+
String used to determine spacing to the left of the array string.
341363
Default: ""
342-
suffix (str, optional): String that determines length of the last line
343-
of the array string.
364+
suffix (str, optional):
365+
String that determines length of the last line of the array string.
344366
Default: ""
345367
346368
Returns:

dpctl/tensor/_reduction.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def sum(x, axis=None, dtype=None, keepdims=False):
194194
dtype (Optional[dtype]):
195195
data type of the returned array. If `None`, the default data
196196
type is inferred from the "kind" of the input array data type.
197+
197198
* If `x` has a real-valued floating-point data type,
198199
the returned array will have the default real-valued
199200
floating-point data type for the device where input
@@ -220,6 +221,7 @@ def sum(x, axis=None, dtype=None, keepdims=False):
220221
compatible with the input arrays according to Array Broadcasting
221222
rules. Otherwise, if `False`, the reduced axes are not included in
222223
the returned array. Default: `False`.
224+
223225
Returns:
224226
usm_ndarray:
225227
an array containing the sums. If the sum was computed over the
@@ -254,6 +256,7 @@ def prod(x, axis=None, dtype=None, keepdims=False):
254256
dtype (Optional[dtype]):
255257
data type of the returned array. If `None`, the default data
256258
type is inferred from the "kind" of the input array data type.
259+
257260
* If `x` has a real-valued floating-point data type,
258261
the returned array will have the default real-valued
259262
floating-point data type for the device where input
@@ -280,6 +283,7 @@ def prod(x, axis=None, dtype=None, keepdims=False):
280283
compatible with the input arrays according to Array Broadcasting
281284
rules. Otherwise, if `False`, the reduced axes are not included in
282285
the returned array. Default: `False`.
286+
283287
Returns:
284288
usm_ndarray:
285289
an array containing the products. If the product was computed over
@@ -315,6 +319,7 @@ def logsumexp(x, axis=None, dtype=None, keepdims=False):
315319
dtype (Optional[dtype]):
316320
data type of the returned array. If `None`, the default data
317321
type is inferred from the "kind" of the input array data type.
322+
318323
* If `x` has a real-valued floating-point data type,
319324
the returned array will have the default real-valued
320325
floating-point data type for the device where input
@@ -333,6 +338,7 @@ def logsumexp(x, axis=None, dtype=None, keepdims=False):
333338
compatible with the input arrays according to Array Broadcasting
334339
rules. Otherwise, if `False`, the reduced axes are not included in
335340
the returned array. Default: `False`.
341+
336342
Returns:
337343
usm_ndarray:
338344
an array containing the results. If the result was computed over
@@ -370,6 +376,7 @@ def reduce_hypot(x, axis=None, dtype=None, keepdims=False):
370376
dtype (Optional[dtype]):
371377
data type of the returned array. If `None`, the default data
372378
type is inferred from the "kind" of the input array data type.
379+
373380
* If `x` has a real-valued floating-point data type,
374381
the returned array will have the default real-valued
375382
floating-point data type for the device where input
@@ -388,6 +395,7 @@ def reduce_hypot(x, axis=None, dtype=None, keepdims=False):
388395
compatible with the input arrays according to Array Broadcasting
389396
rules. Otherwise, if `False`, the reduced axes are not included in
390397
the returned array. Default: `False`.
398+
391399
Returns:
392400
usm_ndarray:
393401
an array containing the results. If the result was computed over

dpctl/tensor/_type_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ def iinfo(dtype):
629629
630630
Returns:
631631
iinfo_object:
632-
An object with the following attributes
632+
An object with the following attributes:
633+
633634
* bits: int
634635
number of bits occupied by the data type
635636
* max: int
@@ -658,7 +659,8 @@ def finfo(dtype):
658659
659660
Returns:
660661
finfo_object:
661-
an object have the following attributes
662+
an object have the following attributes:
663+
662664
* bits: int
663665
number of bits occupied by dtype.
664666
* eps: float

dpctl/tensor/_usmarray.pyx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,23 @@ cdef class usm_ndarray:
8282
If ``dtype`` has the value ``None``, it is determined by default
8383
floating point type supported by target device.
8484
The supported types are
85-
* ``bool``
86-
boolean type
87-
* ``int8``, ``int16``, ``int32``, ``int64``,
88-
signed integer types
89-
* ``uint8``, ``uint16``, ``uint32``, ``uint64``,
90-
unsigned integer types
91-
* ``float16``
92-
half-precision floating type,
93-
supported if target device's property
94-
``has_aspect_fp16`` is ``True``
95-
* ``float32``, ``complex64``
96-
single-precision real and complex floating
97-
types
98-
* ``float64``, ``complex128``
99-
double-precision real and complex floating
100-
types, supported if target device's property
101-
``has_aspect_fp64`` is ``True``.
85+
86+
``bool``:
87+
boolean type
88+
``int8``, ``int16``, ``int32``, ``int64``:
89+
signed integer types
90+
``uint8``, ``uint16``, ``uint32``, ``uint64``:
91+
unsigned integer types
92+
``float16``:
93+
half-precision floating type,
94+
supported if target device's property
95+
``has_aspect_fp16`` is ``True``
96+
``float32``, ``complex64``:
97+
single-precision real and complex floating types
98+
``float64``, ``complex128``:
99+
double-precision real and complex floating
100+
types, supported if target device's property
101+
``has_aspect_fp64`` is ``True``.
102102
Default: ``None``.
103103
strides (tuple, optional):
104104
Strides of the array to be created in elements.

dpctl/utils/_onetrace_context.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,20 @@ def onetrace_enabled():
3232
"""Enable `onetrace` collection for kernels executed in this context.
3333
3434
N.B.: Proper working of this utility assumes that Python interpreter
35-
has been launched by `onetrace` tool from intel/pti-gpu project.
35+
has been launched by `onetrace` or `unitrace` tool from project
36+
`intel/pti-gpu <https://github.com/intel/pti-gpu>`_.
3637
3738
:Example:
38-
Launch the Python interpreter using `onetrace` tool: ::
39+
Launch the Python interpreter using `onetrace` tool:
40+
41+
.. code-block:: bash
3942
4043
$ onetrace --conditional-collection -v -t --demangle python app.py
4144
4245
Now using the context manager in the Python sessions enables
43-
data collection and its output for every offloaded kernel ::
46+
data collection and its output for every offloaded kernel:
47+
48+
.. code-block:: python
4449
4550
import dpctl.tensor as dpt
4651
from dpctl.utils import onetrace_enabled

0 commit comments

Comments
 (0)