dpctl.SyclDevice.get_filter_string

SyclDevice.get_filter_string(include_backend=True, include_device_type=True)

For a parent device, returns a filter selector string that includes backend or device type based on the value of the given keyword arguments.

Parameters:
  • include_backend (bool, optional) – A flag indicating if the backend should be included in the filter string. Default: True.

  • include_device_type (bool, optional) – A flag indicating if the device type should be included in the filter string. Default: True.

Returns:

A Python string representing a filter selector string.

Return type:

str

Raises:
  • TypeError – If the device is a sub-device.

  • ValueError – If no match for the device was found in the vector returned by sycl::device::get_devices()

Example:
import dpctl

# Create a GPU SyclDevice
gpu_dev = dpctl.SyclDevice("gpu:0")
# filter string should be "gpu:0"
fs = gpu_dev.get_filter_string(use_backend=False)
dev = dpctl.SyclDevice(fs)
assert gpu _dev == dev