Skip to content

Commit 5a60bd0

Browse files
author
Diptorup Deb
authored
Doc fixes. (#428)
* Doc updates for current master.
1 parent 584449d commit 5a60bd0

File tree

8 files changed

+73
-53
lines changed

8 files changed

+73
-53
lines changed

docs/doc_versions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
0.7.0
12
0.6.1
23
latest

docs/docfiles/dpctl.dptensor_api.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/docfiles/dpctl.tensor_api.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _dpctl.tensor_api:
2+
3+
############
4+
dpctl.tensor
5+
############
6+
7+
.. automodule:: dpctl.tensor
8+
:members:
9+
:undoc-members:

docs/docfiles/dpctl_pyapi.rst

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ dpctl Python API
99
Sub-modules
1010
-----------
1111

12-
.. toctree::
13-
:maxdepth: 1
14-
15-
dpctl.dptensor_api
16-
dpctl.memory_api
17-
dpctl.program_api
12+
:mod:`dpctl.memory`
13+
USM allocators and deallocators and classes that implement Python's
14+
`buffer protocol`_.
15+
:mod:`dpctl.program`
16+
Experimental wrappers for SYCL 1.2 ``program`` and ``kernel`` classes.
17+
The module is going to be refactored in the future to support SYCL
18+
2020's ``kernel_bundle`` feature and the wrapper for the ``program``
19+
class is going to be removed.
20+
:mod:`dpctl.tensor`
21+
Implementation of different types of tensor classes that use USM memory.
1822

1923
Classes
2024
-------
@@ -44,8 +48,8 @@ Exceptions
4448
.. autoexception:: dpctl.SyclKernelSubmitError
4549
.. autoexception:: dpctl.SyclQueueCreationError
4650

47-
Functions
48-
---------
51+
Device Selection Functions
52+
--------------------------
4953

5054
.. autofunction:: get_devices
5155
.. autofunction:: select_accelerator_device
@@ -58,12 +62,23 @@ Functions
5862
.. autofunction:: has_gpu_devices
5963
.. autofunction:: has_accelerator_devices
6064
.. autofunction:: has_host_device
61-
.. autofunction:: get_platforms
62-
.. autofunction:: lsplatform
65+
66+
DPCTL Queue Management Functions
67+
--------------------------------
68+
6369
.. autofunction:: device_context
6470
.. autofunction:: get_current_backend
6571
.. autofunction:: get_current_device_type
6672
.. autofunction:: get_current_queue
6773
.. autofunction:: get_num_activated_queues
6874
.. autofunction:: is_in_device_context
6975
.. autofunction:: set_global_queue
76+
77+
Other Helper Functions
78+
----------------------
79+
.. autofunction:: get_platforms
80+
.. autofunction:: lsplatform
81+
82+
.. _Section 4.6: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_sycl_runtime_classes
83+
.. _SYCL 2020 spec: https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html
84+
.. _buffer protocol: https://docs.python.org/3/c-api/buffer.html

dpctl/__init__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@
1515
# limitations under the License.
1616

1717
"""
18-
**Data Parallel Control (dpctl)**
18+
**Data Parallel Control (dpctl)** is a Python abstraction layer over SYCL.
1919
20-
Dpctl's Python API implements Python wrappers for a subset of DPC++/SYCL's
21-
API. The Python API exposes wrappers for the SYCL runtime classes (expect
22-
``device_selector``) described in Section 4.6 of the
23-
[SYCL 2020 spec](https://www.khronos.org/registry/SYCL/specs/sycl-2020/
24-
html/sycl-2020.html#_sycl_runtime_classes).
25-
Apart from the main SYCL runtime classes, dpctl includes a `memory`
26-
sub-module that exposes the SYCL USM allocators and deallocators.
20+
Dpctl implements a subset of SYCL's API providing wrappers for the
21+
SYCL runtime classes described in `Section 4.6`_ of the `SYCL 2020 spec`_.
22+
Note that the SYCL ``device_selector`` class is not implemented, instead
23+
there are device selection helper functions that can be used to simulate
24+
the same behavior. Dpctl implements the ``ONEPI::filter_selector`` extension
25+
that is included in Intel's DPC++ SYCL compiler.
26+
27+
The module also includes a global SYCL queue manager. The queue manager
28+
provides convenience functions to create a global instance of
29+
a :class:`dpctl.SyclQueue`, to create a nested stack of queue objects, and
30+
to create a queue object for use only within a specific scope.
2731
"""
2832
__author__ = "Intel Corp."
2933

dpctl/_sycl_device_factory.pyx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,11 @@ cpdef SyclDevice select_accelerator_device():
266266
""" A wrapper for SYCL's ``accelerator_selector`` class.
267267
268268
Returns:
269-
A new class:`dpctl.SyclDevice` object containing the SYCL device
270-
returned by the ``accelerator_selector``.
269+
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
270+
returned by the SYCL ``accelerator_selector``.
271271
Raises:
272-
A ``ValueError`` is raised if the SYCL ``accelerator_selector`` is
273-
unable to select a device.
272+
ValueError: If the SYCL ``accelerator_selector`` is unable to select a
273+
``device``.
274274
"""
275275
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLAcceleratorSelector_Create()
276276
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)
@@ -286,11 +286,11 @@ cpdef SyclDevice select_cpu_device():
286286
""" A wrapper for SYCL's ``cpu_selector`` class.
287287
288288
Returns:
289-
A new class:`dpctl.SyclDevice` object containing the SYCL device
290-
returned by the ``cpu_selector``.
289+
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
290+
returned by the SYCL ``cpu_selector``.
291291
Raises:
292-
A ``ValueError`` is raised if the SYCL ``cpu_selector`` is unable to
293-
select a device.
292+
ValueError: If the SYCL ``cpu_selector`` is unable to select a
293+
``device``.
294294
"""
295295
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLCPUSelector_Create()
296296
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)
@@ -306,11 +306,11 @@ cpdef SyclDevice select_default_device():
306306
""" A wrapper for SYCL's ``default_selector`` class.
307307
308308
Returns:
309-
A new class:`dpctl.SyclDevice` object containing the SYCL device
310-
returned by the ``default_selector``.
309+
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
310+
returned by the SYCL ``default_selector``.
311311
Raises:
312-
A ``ValueError`` is raised if the SYCL ``default_selector`` is unable to
313-
select a device.
312+
ValueError: If the SYCL ``default_selector`` is unable to select a
313+
``device``.
314314
"""
315315
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLDefaultSelector_Create()
316316
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)
@@ -326,11 +326,11 @@ cpdef SyclDevice select_gpu_device():
326326
""" A wrapper for SYCL's ``gpu_selector`` class.
327327
328328
Returns:
329-
A new class:`dpctl.SyclDevice` object containing the SYCL device
330-
returned by the ``gpu_selector``.
329+
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
330+
returned by the SYCL ``gpu_selector``.
331331
Raises:
332-
A ``ValueError`` is raised if the SYCL `gpu_selector` is unable to
333-
select a device.
332+
ValueError: If the SYCL ``gpu_selector`` is unable to select a
333+
``device``.
334334
"""
335335
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLGPUSelector_Create()
336336
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)
@@ -346,11 +346,11 @@ cpdef SyclDevice select_host_device():
346346
""" A wrapper for SYCL's ``host_selector`` class.
347347
348348
Returns:
349-
A new class:`dpctl.SyclDevice` object containing the SYCL device
350-
returned by the ``host_selector``.
349+
dpctl.SyclDevice: A Python object wrapping the SYCL ``device``
350+
returned by the SYCL ``host_selector``.
351351
Raises:
352-
A ``ValueError`` is raised if the SYCL ``host_selector`` is unable to
353-
select a device.
352+
ValueError: If the SYCL ``host_selector`` is unable to select a
353+
``device``.
354354
"""
355355
cdef DPCTLSyclDeviceSelectorRef DSRef = DPCTLHostSelector_Create()
356356
cdef DPCTLSyclDeviceRef DRef = DPCTLDevice_CreateFromSelector(DSRef)

dpctl/_sycl_queue_manager.pyx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,9 @@ cdef class _SyclQueueManager:
144144
or created from given arguments.
145145
146146
Args:
147-
A SyclQueue instance to be used as a global queue.
148-
Alternatively, a filter selector string, or a SyclDevice
149-
instance to be used to construct SyclQueue.
150-
147+
arg: An instance of :class:`dpctl.SyclQueue` or a filter selector
148+
string to be used to construct a :class:`dpctl.SyclQueue`. The
149+
queue is stored in the dpctl queue manager as the default queue.
151150
Raises:
152151
SyclQueueCreationError: If a SYCL queue could not be created.
153152
"""

dpctl/tensor/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
2424
Available tensor implementations:
2525
26-
* ``numpy_usm_shared``: Provides a ``numpy.ndarray`` sub-class whose
27-
underlying memory buffer is allocated with a USM shared memory allocator.
26+
``numpy_usm_shared``:
27+
Provides a ``numpy.ndarray`` sub-class whose underlying memory buffer
28+
is allocated with a USM shared memory allocator.
2829
2930
"""

0 commit comments

Comments
 (0)