dpctl.SyclDevice

class dpctl.SyclDevice

Python equivalent for cl::sycl::device class.

There are two ways of creating a SyclDevice instance:

  • by directly passing in a filter string to the class constructor. The

filter string needs to conform to the the DPC++ filter selector SYCL extension.

Example
import dpctl

# Create a SyclDevice with an explicit filter string, in
# this case the first level_zero gpu device.
level_zero_gpu = dpctl.SyclDevice("level_zero:gpu:0"):
level_zero_gpu.print_device_info()
  • by calling one of the device selector helper functions:

    dpctl.select_accelerator_device(), dpctl.select_cpu_device(), dpctl.select_default_device(), dpctl.select_gpu_device(), dpctl.select_host_device().

Example
import dpctl

# Create a SyclDevice of type GPU based on whatever is returned
# by the SYCL `gpu_selector` device selector class.
gpu = dpctl.select_gpu_device():
gpu.print_device_info()
addressof_ref()

Returns the address of the DPCTLSyclDeviceRef pointer as a size_t.

Returns

The address of the DPCTLSyclDeviceRef object used to create this SyclDevice cast to a size_t.

Return type

int

backend

Returns the backend_type enum value for this device

Returns

The backend for the device.

Return type

backend_type

create_sub_devices()
default_selector_score
device_name

Returns the name of the device as a string

device_type

Returns the type of the device as a device_type enum.

Returns

The type of device encoded as a device_type enum.

Return type

device_type

Raises

A ValueError is raised if the device type is not recognized.

driver_version

Returns a backend-defined driver version as a string.

has_aspect_accelerator
has_aspect_cpu
has_aspect_custom
has_aspect_fp16
has_aspect_fp64
has_aspect_gpu
has_aspect_host
has_aspect_image
has_aspect_int64_base_atomics
has_aspect_int64_extended_atomics
has_aspect_online_compiler
has_aspect_online_linker
has_aspect_queue_profiling
has_aspect_usm_device_allocations
has_aspect_usm_host_allocations
has_aspect_usm_restricted_shared_allocations
has_aspect_usm_shared_allocations
has_aspect_usm_system_allocator
is_accelerator

Returns True if the SyclDevice instance is a SYCL accelerator device.

Returns

True if the SyclDevice is a SYCL accelerator device, else False.

Return type

bool

is_cpu

Returns True if the SyclDevice instance is a SYCL CPU device.

Returns

True if the SyclDevice is a SYCL CPU device, else False.

Return type

bool

is_gpu

Returns True if the SyclDevice instance is a SYCL GPU device.

Returns

True if the SyclDevice is a SYCL GPU device, else False.

Return type

bool

is_host

Returns True if the SyclDevice instance is a SYCL host device.

Returns

True if the SyclDevice is a SYCL host device, else False.

Return type

bool

max_compute_units

Returns the number of parallel compute units available to the device. The minimum value is 1.

max_num_sub_groups

Returns the maximum number of sub-groups in a work-group for any kernel executed on the device. The minimum value is 1.

max_work_group_size

Returns the maximum number of work-items that are permitted in a work-group executing a kernel on a single compute unit. The minimum value is 1.

max_work_item_dims

Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model. The cb value is 3 if this SYCL device is not of device type info::device_type::custom.

max_work_item_sizes

Returns the maximum number of work-items that are permitted in each dimension of the work-group of the nd_range. The minimum value is (1; 1; 1) for devices that are not of device type info::device_type::custom.

preferred_vector_width_char

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_double

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_float

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_half

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_int

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_long

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

preferred_vector_width_short

Returns the preferred native vector width size for built-in scalar types that can be put into vectors.

print_device_info()

Print information about the SYCL device.

sub_group_independent_forward_progress

Returns true if the device supports independent forward progress of sub-groups with respect to other sub-groups in the same work-group.

vendor_name

Returns the device vendor name as a string.