Skip to content

Commit 4b491e6

Browse files
author
Diptorup Deb
committed
Add docstrings.
1 parent 9d71940 commit 4b491e6

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

docs/dpCtl_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Classes
1515

1616
.. autoclass:: dpctl.SyclDevice
1717
:members:
18+
:inherited-members:
1819
:undoc-members:
1920

2021
.. autoclass:: dpctl.SyclEvent

dpctl/_sycl_device.pyx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,32 +232,40 @@ cdef class SyclDevice(_SyclDevice):
232232
""" Python equivalent for cl::sycl::device class.
233233
234234
There are two ways of creating a SyclDevice instance:
235-
- by directly passing in a string to the class constructor.
236235
237-
:Example:
236+
- by directly passing in a filter string to the class constructor. The
237+
filter string needs to conform to the the `DPC++ filter selector SYCL
238+
extension <https://bit.ly/37kqANT>`_.
238239
240+
:Example:
239241
.. code-block:: python
240242
241-
import dpctl
243+
import dpctl
242244
243-
l0gpu = dpctl.SyclDevice("level0:gpu:0"):
244-
l0gpu.dump_device_info()
245+
# Create a SyclDevice with an explicit filter string, in
246+
# this case the first level_zero gpu device.
247+
level_zero_gpu = dpctl.SyclDevice("level_zero:gpu:0"):
248+
level_zero_gpu.dump_device_info()
245249
246250
- by calling one of the device selector helper functions:
247-
:py:meth:`~dpctl.select_accelerator_device`,
248-
:py:meth:`~dpctl.select_cpu_device`,
249-
:py:meth:`~dpctl.select_default_device`,
250-
:py:meth:`~dpctl.select_gpu_device`,
251-
:py:meth:`~dpctl.select_host_device`.
252251
253-
:Example:
252+
:func:`dpctl.select_accelerator_device()`,
253+
:func:`dpctl.select_cpu_device()`,
254+
:func:`dpctl.select_default_device()`,
255+
:func:`dpctl.select_gpu_device()`,
256+
:func:`dpctl.select_host_device()`.
254257
258+
259+
:Example:
255260
.. code-block:: python
256261
257-
import dpctl
262+
import dpctl
263+
264+
# Create a SyclDevice of type GPU based on whatever is returned
265+
# by the SYCL `gpu_selector` device selector class.
266+
gpu = dpctl.select_gpu_device():
267+
gpu.dump_device_info()
258268
259-
gpu = dpctl.select_gpu_device():
260-
gpu.dump_device_info()
261269
"""
262270

263271
@staticmethod

0 commit comments

Comments
 (0)