dpctl.SyclDevice¶
- class dpctl.SyclDevice(arg=None)¶
A Python wrapper for the
sycl::device
C++ 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 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()
- 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()
- Parameters:
arg (str, optional) – The argument can be a selector string or
None
. Defaults toNone
.- Raises:
MemoryError – If the constructor could not allocate necessary temporary memory.
SyclDeviceCreationError – If the
dpctl.SyclDevice
object creation failed.TypeError – If the list of
dpctl.SyclDevice
objects was empty, or the input capsule contained a null pointer or could not be renamed.
Methods
Returns the address of the
DPCTLSyclDeviceRef
pointer as asize_t
.create_sub_devices
([partition])Creates a list of sub-devices by partitioning a root device based on the provided partition specifier.
get_filter_string
([include_backend, ...])For a parent device, returns a filter selector string that includes backend or device type based on the value of the given keyword arguments.
Print information about the SYCL device.
Attributes
Returns the
backend_type
enum value for this deviceIntegral score assigned to this device by DPC++ runtime's default selector's scoring function.
Returns the type of the device as a
device_type
enum.Returns a backend-defined driver version as a string.
For a root device, returns a fully specified filter selector string
"backend:device_type:relative_id"
selecting the device.Global device memory cache line size.
Global device memory cache size.
Global device cache memory type.
Returns the size of global memory on this device in bytes.
Returns
True
if this device is an accelerator device,False
otherwise.Returns
True
if the device supports a basic set of atomic operations,False
otherwise.Returns
True
if this device is a CPU device,False
otherwise.Returns
True
if this device is a custom device,False
otherwise.Returns
True
if this device is somehow emulated,False
otherwise.Returns
True
if the device supports half-precision floating point operations,False
otherwise.Returns
True
if the device supports 64-bit precision floating point operations,False
otherwise.Returns
True
if this device is a GPU device,False
otherwise.Returns
True
if kernels running on this device can be debugged using standard debuggers that are normally available on the host system,False
otherwise.Returns
True
if the device supports images,False
otherwise (refer Sec 4.15.3 of SYCL 2020 spec).Returns
True
if this device supports online compilation of device code,False
otherwise.Returns
True
if this device supports online linking of device code,False
otherwise.Returns
True
if this device supports queue profiling,False
otherwise.Returns
True
if this device supports USM-host allocations and the host and this device may concurrently access and atomically modify host allocations,False
otherwise.Returns
True
if this device supports USM-shared allocations and the host and other devices in the same context as this device may concurrently access and atomically modify shared allocations,False
otherwise.Returns
True
if this device supports explicit USM allocations,False
otherwise (refer Section 4.8 of SYCL 2020 specs).Returns
True
if this device can access USM-host memory,False
otherwise (refer Section 4.8 of SYCL 2020 specs).Returns
True
if this device supports USM-shared memory allocated on the same device,False
otherwise.Returns
True
if system allocator may be used instead of SYCL USM allocation mechanism for USM-shared allocations on this device,False
otherwise.Returns the maximum height of a 2D image or 1D image in pixels.
Returns the maximum width of a 2D image or 1D image in pixels.
Returns the maximum depth of a 3D image in pixels.
Returns the maximum height of a 3D image in pixels.
Returns the maximum width of a 3D image in pixels.
Returns
True
if this instance is a SYCL accelerator device.Returns
True
if this instance is a SYCL CPU device.Returns
True
if this instance is a SYCL GPU device.Returns the size of local memory on this device in bytes.
Maximal clock frequency in MHz.
Returns the number of parallel compute units available to the device.
Maximum size of memory object than can be allocated.
Returns the maximum number of sub-groups in a work-group for any kernel executed on the device.
Returns the maximum number of simultaneous image objects that can be read from by a kernel.
Returns the maximum number of work-items that are permitted in a work-group executing a kernel on a single compute unit.
Returns the maximum dimensions that specify the global and local work-item IDs used by the data parallel execution model.
Returns the maximum number of work-items that are permitted in each dimension of the work-group of the nd_range.
Returns the maximum number of work-items that are permitted in each dimension of the work-group of the
sycl::nd_range<1>
.Returns the maximum number of work-items that are permitted in each dimension of the work-group of the
sycl::nd_range<2>
.Returns the maximum number of work-items that are permitted in each dimension of the work-group of the
sycl::nd_range<3>
.Returns the maximum number of simultaneous image objects that can be written to by a kernel.
Returns the name of the device as a string
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Returns the native ISA vector width size for built-in scalar types that can be put into vectors.
Parent device for a sub-device, or None for a root device.
The maximum number of sub-devices this
dpctl.SyclDevice
instance can be partitioned into.Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Returns the preferred native vector width size for built-in scalar types that can be put into vectors.
Profiling timer resolution.
Returns
True
if the device supports independent forward progress of sub-groups with respect to other sub-groups in the same work-group.Returns list of supported sub-group sizes for this device.
Returns the platform associated with this device.
Returns the device vendor name as a string.