Skip to content

Commit

Permalink
Add docstring for dpctl.SyclDevice.get_device_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ndgrigorian committed Jan 14, 2025
1 parent 5300216 commit b1e8df1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dpctl/_sycl_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,23 @@ cdef class SyclDevice(_SyclDevice):
return str(relId)

def get_device_id(self):
""" get_device_id()
For a parent device, returns the canonical index of this device in the
list of devices visible to dpctl.
Returns:
int:
The index of the device.
Raises:
ValueError:
If the device is a sub-device.
:Example:
.. code-block:: python
import dpctl
gpu_dev = dpctl.SyclDevice("gpu")
i = gpu_dev.get_device_id
devs = dpctl.get_devices()
assert devs[i] == gpu_dev
"""
cdef int dev_id = -1

if self.parent_device:
Expand Down

0 comments on commit b1e8df1

Please sign in to comment.