# Data Parallel Control (dpctl)## Copyright 2020-2024 Intel Corporation## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.from.._sycl_deviceimportSyclDevicefrom._device_queriesimport(intel_device_info_device_id,intel_device_info_free_memory,intel_device_info_gpu_eu_count,intel_device_info_gpu_eu_count_per_subslice,intel_device_info_gpu_eu_simd_width,intel_device_info_gpu_hw_threads_per_eu,intel_device_info_gpu_slices,intel_device_info_gpu_subslices_per_slice,intel_device_info_max_mem_bandwidth,intel_device_info_memory_bus_width,intel_device_info_memory_clock_rate,)
[docs]defintel_device_info(dev,/):"""intel_device_info(sycl_device) For Intel(R) GPU devices returns a dictionary with device architectural details, and an empty dictionary otherwise. The dictionary contains the following keys: device_id: 32-bits device PCI identifier gpu_eu_count: Total number of execution units gpu_hw_threads_per_eu: Number of thread contexts in EU gpu_eu_simd_width: Physical SIMD width of EU gpu_slices: Total number of slices gpu_subslices_per_slice: Number of sub-slices per slice gpu_eu_count_per_subslice: Number of EUs in subslice max_mem_bandwidth: Maximum memory bandwidth in bytes/second free_memory: Global memory available on the device in units of bytes Unsupported descriptors are omitted from the dictionary. Descriptors other than the PCI identifier are supported only for :class:`.SyclDevices` with Level-Zero backend. .. note:: Environment variable ``ZES_ENABLE_SYSMAN`` may need to be set to ``1`` for the ``"free_memory"`` key to be reported. """ifnotisinstance(dev,SyclDevice):raiseTypeError(f"Expected dpctl.SyclDevice, got {type(dev)}")dev_id=intel_device_info_device_id(dev)ifdev_id:res={"device_id":dev_id,}ifdev.has_aspect_gpu:eu_count=intel_device_info_gpu_eu_count(dev)ifeu_count:res["gpu_eu_count"]=eu_counthw_threads=intel_device_info_gpu_hw_threads_per_eu(dev)ifhw_threads:res["gpu_hw_threads_per_eu"]=hw_threadssimd_w=intel_device_info_gpu_eu_simd_width(dev)ifsimd_w:res["gpu_eu_simd_width"]=simd_wn_slices=intel_device_info_gpu_slices(dev)ifn_slices:res["gpu_slices"]=n_slicesn_subslices=intel_device_info_gpu_subslices_per_slice(dev)ifn_subslices:res["gpu_subslices_per_slice"]=n_subslicesn_eu_per_subslice=intel_device_info_gpu_eu_count_per_subslice(dev)ifn_eu_per_subslice:res["gpu_eu_count_per_subslice"]=n_eu_per_subslicebw=intel_device_info_max_mem_bandwidth(dev)ifbw:res["max_mem_bandwidth"]=bwfm=intel_device_info_free_memory(dev)iffm:res["free_memory"]=fmmcr=intel_device_info_memory_clock_rate(dev)ifmcr:res["memory_clock_rate"]=mcrmbw=intel_device_info_memory_bus_width(dev)ifmbw:res["memory_bus_width"]=mbwreturnresreturndict()