File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1950,9 +1950,7 @@ cdef class SyclDevice(_SyclDevice):
1950
1950
1951
1951
cdef int get_overall_ordinal(self ):
1952
1952
""" If this device is a root ``sycl::device``, returns the ordinal
1953
- position of this device in the vector ``sycl::device::get_devices()``
1954
- filtered to contain only devices with the same backend as this
1955
- device.
1953
+ position of this device in the vector ``sycl::device::get_devices()``.
1956
1954
1957
1955
Returns -1 if the device is a sub-device, or the device could not
1958
1956
be found in the vector.
@@ -2045,6 +2043,18 @@ cdef class SyclDevice(_SyclDevice):
2045
2043
else :
2046
2044
return str (relId)
2047
2045
2046
+ def get_device_id (self ):
2047
+ cdef int dev_id = - 1
2048
+
2049
+ if self .parent_device:
2050
+ raise TypeError (" This SyclDevice is not a root device" )
2051
+
2052
+ dev_id = self .get_overall_ordinal()
2053
+ if dev_id < 0 :
2054
+ raise ValueError
2055
+ return dev_id
2056
+
2057
+
2048
2058
cdef api DPCTLSyclDeviceRef SyclDevice_GetDeviceRef(SyclDevice dev):
2049
2059
"""
2050
2060
C-API function to get opaque device reference from
You can’t perform that action at this time.
0 commit comments