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()
Attributes:
backendReturns the backend_type enum value for this device
default_selector_scoredevice_typeReturns the type of the device as a device_type enum.
driver_versionReturns a backend-defined driver version as a string.
filter_stringFor a parent device returns a tuple (backend, device_kind, relative_id).
has_aspect_acceleratorhas_aspect_cpuhas_aspect_customhas_aspect_fp16has_aspect_fp64has_aspect_gpuhas_aspect_hosthas_aspect_imagehas_aspect_int64_base_atomicshas_aspect_int64_extended_atomicshas_aspect_online_compilerhas_aspect_online_linkerhas_aspect_queue_profilinghas_aspect_usm_device_allocationshas_aspect_usm_host_allocationshas_aspect_usm_restricted_shared_allocationshas_aspect_usm_shared_allocationshas_aspect_usm_system_allocatorimage_2d_max_heightReturns the maximum height of a 2D image or 1D image in pixels.
image_2d_max_widthReturns the maximum width of a 2D image or 1D image in pixels.
image_3d_max_depthReturns the maximum depth of a 3D image in pixels.
image_3d_max_heightReturns the maximum height of a 3D image in pixels.
image_3d_max_widthReturns the maximum width of a 3D image in pixels.
is_acceleratorReturns True if the SyclDevice instance is a SYCL accelerator device.
is_cpuReturns True if the SyclDevice instance is a SYCL CPU device.
is_gpuReturns True if the SyclDevice instance is a SYCL GPU device.
is_hostReturns True if the SyclDevice instance is a SYCL host device.
max_compute_unitsReturns the number of parallel compute units available to the device.
max_num_sub_groupsReturns the maximum number of sub-groups in a work-group for any kernel executed on the device.
max_read_image_argsReturns the maximum number of simultaneous image objects that can be read from by a kernel.
max_work_group_sizeReturns the maximum number of work-items that are permitted in a work-group executing a kernel on a single compute unit.
max_work_item_dimsReturns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model.
max_work_item_sizesReturns the maximum number of work-items that are permitted in each dimension of the work-group of the nd_range.
max_write_image_argsReturns the maximum number of simultaneous image objects that can be written to by a kernel.
nameReturns the name of the device as a string
parent_deviceParent device for a sub-device, or None for a root device.
preferred_vector_width_charReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_doubleReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_floatReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_halfReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_intReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_longReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
preferred_vector_width_shortReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
sub_group_independent_forward_progressReturns true if the device supports independent forward progress of sub-groups with respect to other sub-groups in the same work-group.
vendorReturns the device vendor name as a string.
Public methods:
addressof_refReturns the address of the DPCTLSyclDeviceRef pointer as a size_t.
create_sub_devicesprint_device_infoPrint information about the SYCL device.
Detail¶
Public methods¶
SyclDevice.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
SyclDevice.backendReturns the backend_type enum value for this device
- Returns
The backend for the device.
- Return type
SyclDevice.create_sub_devices()
SyclDevice.default_selector_score
SyclDevice.device_typeReturns the type of the device as a device_type enum.
- Returns
The type of device encoded as a device_type enum.
- Return type
- Raises
A ValueError is raised if the device type is not recognized. –
SyclDevice.driver_versionReturns a backend-defined driver version as a string.
SyclDevice.filter_stringFor a parent device returns a tuple (backend, device_kind, relative_id). Raises an exception for sub-devices.
SyclDevice.has_aspect_accelerator
SyclDevice.has_aspect_cpu
SyclDevice.has_aspect_custom
SyclDevice.has_aspect_fp16
SyclDevice.has_aspect_fp64
SyclDevice.has_aspect_gpu
SyclDevice.has_aspect_host
SyclDevice.has_aspect_image
SyclDevice.has_aspect_int64_base_atomics
SyclDevice.has_aspect_int64_extended_atomics
SyclDevice.has_aspect_online_compiler
SyclDevice.has_aspect_online_linker
SyclDevice.has_aspect_queue_profiling
SyclDevice.has_aspect_usm_device_allocations
SyclDevice.has_aspect_usm_host_allocations
SyclDevice.has_aspect_usm_restricted_shared_allocations
SyclDevice.has_aspect_usm_shared_allocations
SyclDevice.has_aspect_usm_system_allocator
SyclDevice.image_2d_max_heightReturns the maximum height of a 2D image or 1D image in pixels. The minimum value is 8192 if the SYCL device has aspect::image.
SyclDevice.image_2d_max_widthReturns the maximum width of a 2D image or 1D image in pixels. The minimum value is 8192 if the SYCL device has aspect::image.
SyclDevice.image_3d_max_depthReturns the maximum depth of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.
SyclDevice.image_3d_max_heightReturns the maximum height of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.
SyclDevice.image_3d_max_widthReturns the maximum width of a 3D image in pixels. The minimum value is 2048 if the SYCL device has aspect::image.
SyclDevice.is_acceleratorReturns 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
SyclDevice.is_cpuReturns 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
SyclDevice.is_gpuReturns 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
SyclDevice.is_hostReturns 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
SyclDevice.max_compute_unitsReturns the number of parallel compute units available to the device. The minimum value is 1.
SyclDevice.max_num_sub_groupsReturns the maximum number of sub-groups in a work-group for any kernel executed on the device. The minimum value is 1.
SyclDevice.max_read_image_argsReturns the maximum number of simultaneous image objects that can be read from by a kernel. The minimum value is 128 if the SYCL device has aspect::image.
SyclDevice.max_work_group_sizeReturns 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.
SyclDevice.max_work_item_dimsReturns 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.
SyclDevice.max_work_item_sizesReturns 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.
SyclDevice.max_write_image_argsReturns the maximum number of simultaneous image objects that can be written to by a kernel. The minimum value is 8 if the SYCL device has aspect::image.
SyclDevice.nameReturns the name of the device as a string
SyclDevice.parent_deviceParent device for a sub-device, or None for a root device.
SyclDevice.preferred_vector_width_charReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_doubleReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_floatReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_halfReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_intReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_longReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.preferred_vector_width_shortReturns the preferred native vector width size for built-in scalar types that can be put into vectors.
SyclDevice.print_device_info()Print information about the SYCL device.
SyclDevice.sub_group_independent_forward_progressReturns true if the device supports independent forward progress of sub-groups with respect to other sub-groups in the same work-group.
SyclDevice.vendorReturns the device vendor name as a string.