Skip to content

Commit c6b4f98

Browse files
jingxu10guangyeymalfet
authored andcommitted
Add Intel GPU info collection to the collect env script (pytorch#137846)
As title, add Intel GPU info collection to the collect env script Output examples: 1. CPU on Windows ``` C:\Users\user\miniforge3\envs\py310\lib\site-packages\torch\_subclasses\functional_tensor.py:279: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\pytorch\torch\csrc\utils\tensor_numpy.cpp:81.) cpu = _conversion_method_template(device=torch.device("cpu")) Collecting environment information... PyTorch version: 2.8.0.dev20250528+cpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: Microsoft Windows 11 Enterprise (10.0.22631 64-bit) GCC version: Could not collect Clang version: Could not collect CMake version: Could not collect Libc version: N/A Python version: 3.10.17 | packaged by conda-forge | (main, Apr 10 2025, 22:06:35) [MSC v.1943 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.22631-SP0 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Name: 12th Gen Intel(R) Core(TM) i7-1270P Manufacturer: GenuineIntel Family: 198 Architecture: 9 ProcessorType: 3 DeviceID: CPU0 CurrentClockSpeed: 1711 MaxClockSpeed: 2200 L2CacheSize: 9216 L2CacheSpeed: None Revision: None Versions of relevant libraries: [pip3] torch==2.8.0.dev20250528+cpu [conda] torch 2.8.0.dev20250528+cpu pypi_0 pypi ``` 2. XPU on Windows ``` Collecting environment information... PyTorch version: 2.8.0a0+gitef6306e Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: Microsoft Windows 10 Pro (10.0.19045 64-bit) GCC version: (GCC) 13.1.0 Clang version: Could not collect CMake version: version 3.29.3 Libc version: N/A Python version: 3.10.17 | packaged by conda-forge | (main, Apr 10 2025, 22:06:35) [MSC v.1943 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.19045-SP0 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: True XPU used to build PyTorch: 20250101 Intel GPU driver version: * 32.0.101.6795 (20250520000000.******+***) Intel GPU models onboard: * Intel(R) Arc(TM) A770 Graphics Intel GPU models detected: * [0] _XpuDeviceProperties(name='Intel(R) Arc(TM) A770 Graphics', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.33184', total_memory=15915MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=128, sub_group_sizes=[8 16 32], has_fp16=1, has_fp64=0, has_atomic64=1) HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: ---------------------- Name: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz Manufacturer: GenuineIntel Family: 179 Architecture: 9 ProcessorType: 3 DeviceID: CPU0 CurrentClockSpeed: 2401 MaxClockSpeed: 2401 L2CacheSize: 24576 L2CacheSpeed: None Revision: 21767 ---------------------- Name: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz Manufacturer: GenuineIntel Family: 179 Architecture: 9 ProcessorType: 3 DeviceID: CPU1 CurrentClockSpeed: 2200 MaxClockSpeed: 2401 L2CacheSize: 24576 L2CacheSpeed: None Revision: 21767 Versions of relevant libraries: [pip3] intel_extension_for_pytorch==2.8.10+gitb3ea3a1 [pip3] numpy==2.1.2 [pip3] optree==0.13.1 [pip3] pytorch-triton-xpu==3.3.1+gitb0e26b73 [pip3] torch==2.8.0a0+gitef6306e [conda] intel-extension-for-pytorch 2.8.10+gitb3ea3a1 pypi_0 pypi [conda] mkl 2025.1.0 pypi_0 pypi [conda] mkl-dpcpp 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-blas 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-datafitting 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-dft 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-lapack 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-rng 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-sparse 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-stats 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-vm 2025.1.0 pypi_0 pypi [conda] pytorch-triton-xpu 3.3.1+gitb0e26b73 pypi_0 pypi [conda] torch 2.8.0a0+gitef6306e pypi_0 pypi ``` 3. CPU on Linux ``` /opt/python/cp312-cp312/lib/python3.12/site-packages/torch/_subclasses/functional_tensor.py:279: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.) cpu = _conversion_method_template(device=torch.device("cpu")) Collecting environment information... PyTorch version: 2.8.0.dev20250528+cpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: AlmaLinux 8.10 (Cerulean Leopard) (x86_64) GCC version: (GCC) 14.2.1 20250110 (Red Hat 14.2.1-7) Clang version: Could not collect CMake version: version 4.0.0 Libc version: glibc-2.28 Python version: 3.12.10 (main, Apr 19 2025, 05:03:56) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] (64-bit runtime) Python platform: Linux-6.8.0-40-generic-x86_64-with-glibc2.28 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 88 On-line CPU(s) list: 0-87 Thread(s) per core: 2 Core(s) per socket: 22 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Gold 6238M CPU @ 2.10GHz Stepping: 7 CPU MHz: 1000.000 CPU max MHz: 3700.0000 CPU min MHz: 1000.0000 BogoMIPS: 4200.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 1024K L3 cache: 30976K NUMA node0 CPU(s): 0-21,44-65 NUMA node1 CPU(s): 22-43,66-87 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi pku ospke avx512_vnni md_clear flush_l1d arch_capabilities Versions of relevant libraries: [pip3] torch==2.8.0.dev20250528+cpu [conda] Could not collect ``` 5. XPU on Linux ``` Collecting environment information... PyTorch version: 2.8.0.dev20250516+xpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A OS: Ubuntu 22.04.4 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Clang version: Could not collect CMake version: version 3.31.6 Libc version: glibc-2.35 Python version: 3.10.17 | packaged by conda-forge | (main, Apr 10 2025, 22:19:12) [GCC 13.3.0] (64-bit runtime) Python platform: Linux-5.15.50-051550-generic-x86_64-with-glibc2.35 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: True XPU used to build PyTorch: 20250101 Intel GPU driver version: * intel_opencl: 24.39.31294.21-1032~22.04 * level_zero: 1.17.44.0-1022~22.04 Intel GPU models onboard: * Intel(R) Data Center GPU Max 1550 * Intel(R) Data Center GPU Max 1550 * Intel(R) Data Center GPU Max 1550 * Intel(R) Data Center GPU Max 1550 Intel GPU models detected: * [0] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [1] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [2] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [3] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [4] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [5] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [6] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) * [7] _XpuDeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero', type='gpu', driver_version='1.6.31294+21', total_memory=65536MB, max_compute_units=512, gpu_eu_count=512, gpu_subslice_count=64, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1) HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 224 On-line CPU(s) list: 0-223 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) Platinum 8480+ CPU family: 6 Model: 143 Thread(s) per core: 2 Core(s) per socket: 56 Socket(s): 2 Stepping: 6 CPU max MHz: 3800.0000 CPU min MHz: 800.0000 BogoMIPS: 4000.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr avx512_fp16 flush_l1d arch_capabilities Virtualization: VT-x L1d cache: 5.3 MiB (112 instances) L1i cache: 3.5 MiB (112 instances) L2 cache: 224 MiB (112 instances) L3 cache: 210 MiB (2 instances) NUMA node(s): 2 NUMA node0 CPU(s): 0-55,112-167 NUMA node1 CPU(s): 56-111,168-223 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Versions of relevant libraries: [pip3] numpy==2.2.5 [pip3] pytorch-triton-xpu==3.3.0+git0bcc8265 [pip3] torch==2.8.0.dev20250516+xpu [conda] mkl 2025.1.0 pypi_0 pypi [conda] numpy 2.2.5 pypi_0 pypi [conda] onemkl-sycl-blas 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-dft 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-lapack 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-rng 2025.1.0 pypi_0 pypi [conda] onemkl-sycl-sparse 2025.1.0 pypi_0 pypi [conda] pytorch-triton-xpu 3.3.0+git0bcc8265 pypi_0 pypi [conda] torch 2.8.0.dev20250516+xpu pypi_0 pypi ``` Pull Request resolved: pytorch#137846 Approved by: https://github.com/guangyey, https://github.com/malfet Co-authored-by: Yu, Guangye <[email protected]> Co-authored-by: Nikita Shulga <[email protected]>
1 parent d3d64c6 commit c6b4f98

File tree

1 file changed

+182
-4
lines changed

1 file changed

+182
-4
lines changed

torch/utils/collect_env.py

Lines changed: 182 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import subprocess
1111
import sys
1212
import os
13+
from typing import cast as _cast
1314
from collections import namedtuple
1415

1516

@@ -37,6 +38,7 @@
3738
'nvidia_driver_version',
3839
'nvidia_gpu_models',
3940
'cudnn_version',
41+
'is_xpu_available',
4042
'pip_version', # 'pip' or 'pip3'
4143
'pip_packages',
4244
'conda_packages',
@@ -73,6 +75,30 @@
7375
"nvtx",
7476
]
7577

78+
ONEAPI_PATTERNS = [
79+
"dpcpp-cpp-rt",
80+
"intel-cmplr-lib-rt",
81+
"intel-cmplr-lib-ur",
82+
"intel-cmplr-lic-rt",
83+
"intel-opencl-rt",
84+
"intel-sycl-rt",
85+
"mkl",
86+
"onemkl-sycl-blas",
87+
"onemkl-sycl-dft",
88+
"onemkl-sycl-lapack",
89+
"onemkl-sycl-rng",
90+
"onemkl-sycl-sparse",
91+
"intel-openmp",
92+
"tbb",
93+
"impi-rt",
94+
"impi-devel",
95+
"oneccl",
96+
"oneccl-devel",
97+
"intel-pti",
98+
"umf",
99+
"tcmlib",
100+
]
101+
76102
CONDA_PATTERNS = [
77103
"cudatoolkit",
78104
"soumith",
@@ -131,7 +157,7 @@ def run_and_return_first_line(run_lambda, command):
131157

132158
def get_conda_packages(run_lambda, patterns=None):
133159
if patterns is None:
134-
patterns = CONDA_PATTERNS + COMMON_PATTERNS + NVIDIA_PATTERNS
160+
patterns = CONDA_PATTERNS + COMMON_PATTERNS + NVIDIA_PATTERNS + ONEAPI_PATTERNS
135161
conda = os.environ.get('CONDA_EXE', 'conda')
136162
out = run_and_read_all(run_lambda, "{} list".format(conda))
137163
if out is None:
@@ -243,6 +269,149 @@ def get_nvidia_smi():
243269
return smi
244270

245271

272+
def _detect_linux_pkg_manager():
273+
if get_platform() != "linux":
274+
return "N/A"
275+
for mgr_name in ["dpkg", "dnf", "yum", "zypper"]:
276+
rc, _, _ = run(f"which {mgr_name}")
277+
if rc == 0:
278+
return mgr_name
279+
return "N/A"
280+
281+
282+
def get_linux_pkg_version(run_lambda, pkg_name):
283+
pkg_mgr = _detect_linux_pkg_manager()
284+
if pkg_mgr == "N/A":
285+
return "N/A"
286+
287+
grep_version = {
288+
"dpkg": {
289+
"field_index": 2,
290+
"command": "dpkg -l | grep {}",
291+
},
292+
"dnf": {
293+
"field_index": 1,
294+
"command": "dnf list | grep {}",
295+
},
296+
"yum": {
297+
"field_index": 1,
298+
"command": "yum list | grep {}",
299+
},
300+
"zypper": {
301+
"field_index": 2,
302+
"command": "zypper info {} | grep Version",
303+
},
304+
}
305+
306+
field_index: int = int(_cast(int, grep_version[pkg_mgr]["field_index"]))
307+
cmd: str = str(grep_version[pkg_mgr]["command"])
308+
cmd = cmd.format(pkg_name)
309+
ret = run_and_read_all(run_lambda, cmd)
310+
if ret == "":
311+
return "N/A"
312+
lst = re.sub(" +", " ", ret).split(" ")
313+
if len(lst) <= field_index:
314+
return "N/A"
315+
return lst[field_index]
316+
317+
318+
def get_intel_gpu_driver_version(run_lambda):
319+
lst = []
320+
platform = get_platform()
321+
if platform == "linux":
322+
pkgs = { # type: ignore[var-annotated]
323+
"dpkg": {
324+
"intel-opencl-icd",
325+
"libze1",
326+
},
327+
"dnf": {
328+
"intel-opencl",
329+
"level-zero",
330+
},
331+
"yum": {
332+
"intel-opencl",
333+
"level-zero",
334+
},
335+
"zypper": {
336+
"intel-opencl",
337+
"level-zero",
338+
},
339+
}.get(_detect_linux_pkg_manager(), {})
340+
for pkg in pkgs:
341+
lst.append(f"* {pkg}:\t{get_linux_pkg_version(run_lambda, pkg)}")
342+
if platform in ["win32", "cygwin"]:
343+
txt = run_and_read_all(
344+
run_lambda,
345+
'powershell.exe "gwmi -Class Win32_PnpSignedDriver | where{$_.DeviceClass -eq \\"DISPLAY\\"\
346+
-and $_.Manufacturer -match \\"Intel\\"} | Select-Object -Property DeviceName,DriverVersion,DriverDate\
347+
| ConvertTo-Json"',
348+
)
349+
try:
350+
obj = json.loads(txt)
351+
if type(obj) is list:
352+
for o in obj:
353+
lst.append(
354+
f'* {o["DeviceName"]}: {o["DriverVersion"]} ({o["DriverDate"]})'
355+
)
356+
else:
357+
lst.append(f'* {obj["DriverVersion"]} ({obj["DriverDate"]})')
358+
except ValueError as e:
359+
lst.append(txt)
360+
lst.append(str(e))
361+
return "\n".join(lst)
362+
363+
364+
def get_intel_gpu_onboard(run_lambda):
365+
lst: list[str] = []
366+
platform = get_platform()
367+
if platform == "linux":
368+
txt = run_and_read_all(run_lambda, "xpu-smi discovery -j")
369+
if txt:
370+
try:
371+
obj = json.loads(txt)
372+
device_list = obj.get("device_list", [])
373+
if isinstance(device_list, list) and device_list:
374+
lst.extend(f'* {device["device_name"]}' for device in device_list)
375+
else:
376+
lst.append("N/A")
377+
except (ValueError, TypeError) as e:
378+
lst.append(txt)
379+
lst.append(str(e))
380+
else:
381+
lst.append("N/A")
382+
if platform in ["win32", "cygwin"]:
383+
txt = run_and_read_all(
384+
run_lambda,
385+
'powershell.exe "gwmi -Class Win32_PnpSignedDriver | where{$_.DeviceClass -eq \\"DISPLAY\\"\
386+
-and $_.Manufacturer -match \\"Intel\\"} | Select-Object -Property DeviceName | ConvertTo-Json"',
387+
)
388+
if txt:
389+
try:
390+
obj = json.loads(txt)
391+
if isinstance(obj, list) and obj:
392+
lst.extend(f'* {device["DeviceName"]}' for device in obj)
393+
else:
394+
lst.append(f'* {obj.get("DeviceName", "N/A")}')
395+
except ValueError as e:
396+
lst.append(txt)
397+
lst.append(str(e))
398+
else:
399+
lst.append("N/A")
400+
return "\n".join(lst)
401+
402+
403+
def get_intel_gpu_detected(run_lambda):
404+
if not TORCH_AVAILABLE or not hasattr(torch, "xpu"):
405+
return "N/A"
406+
407+
device_count = torch.xpu.device_count()
408+
if device_count == 0:
409+
return "N/A"
410+
411+
devices = [f"* [{i}] {torch.xpu.get_device_properties(i)}" for i in range(device_count)]
412+
return "\n".join(devices)
413+
414+
246415
# example outputs of CPU infos
247416
# * linux
248417
# Architecture: x86_64
@@ -396,7 +565,7 @@ def get_os(run_lambda):
396565
from platform import machine
397566
platform = get_platform()
398567

399-
if platform == 'win32' or platform == 'cygwin':
568+
if platform in ["win32", "cygwin"]:
400569
return get_windows_version(run_lambda)
401570

402571
if platform == 'darwin':
@@ -437,7 +606,7 @@ def get_libc_version():
437606
def get_pip_packages(run_lambda, patterns=None):
438607
"""Return `pip list` output. Note: will also find conda-installed pytorch and numpy packages."""
439608
if patterns is None:
440-
patterns = PIP_PATTERNS + COMMON_PATTERNS + NVIDIA_PATTERNS
609+
patterns = PIP_PATTERNS + COMMON_PATTERNS + NVIDIA_PATTERNS + ONEAPI_PATTERNS
441610

442611
pip_version = 'pip3' if sys.version_info.major == 3 else 'pip'
443612

@@ -504,6 +673,13 @@ def get_env_info():
504673
debug_mode_str = str(torch.version.debug)
505674
cuda_available_str = str(torch.cuda.is_available())
506675
cuda_version_str = torch.version.cuda
676+
xpu_available_str = str(torch.xpu.is_available())
677+
if torch.xpu.is_available():
678+
xpu_available_str = f'{xpu_available_str}\n' + \
679+
f'XPU used to build PyTorch: {torch.version.xpu}\n' + \
680+
f'Intel GPU driver version:\n{get_intel_gpu_driver_version(run_lambda)}\n' + \
681+
f'Intel GPU models onboard:\n{get_intel_gpu_onboard(run_lambda)}\n' + \
682+
f'Intel GPU models detected:\n{get_intel_gpu_detected(run_lambda)}'
507683
if not hasattr(torch.version, 'hip') or torch.version.hip is None: # cuda version
508684
hip_compiled_version = hip_runtime_version = miopen_runtime_version = 'N/A'
509685
else: # HIP version
@@ -517,7 +693,7 @@ def get_version_or_na(cfg, prefix):
517693
cuda_version_str = 'N/A'
518694
hip_compiled_version = torch.version.hip
519695
else:
520-
version_str = debug_mode_str = cuda_available_str = cuda_version_str = 'N/A'
696+
version_str = debug_mode_str = cuda_available_str = cuda_version_str = xpu_available_str = 'N/A'
521697
hip_compiled_version = hip_runtime_version = miopen_runtime_version = 'N/A'
522698

523699
sys_version = sys.version.replace("\n", " ")
@@ -536,6 +712,7 @@ def get_version_or_na(cfg, prefix):
536712
nvidia_gpu_models=get_gpu_info(run_lambda),
537713
nvidia_driver_version=get_nvidia_driver_version(run_lambda),
538714
cudnn_version=get_cudnn_version(run_lambda),
715+
is_xpu_available=xpu_available_str,
539716
hip_compiled_version=hip_compiled_version,
540717
hip_runtime_version=hip_runtime_version,
541718
miopen_runtime_version=miopen_runtime_version,
@@ -572,6 +749,7 @@ def get_version_or_na(cfg, prefix):
572749
GPU models and configuration: {nvidia_gpu_models}
573750
Nvidia driver version: {nvidia_driver_version}
574751
cuDNN version: {cudnn_version}
752+
Is XPU available: {is_xpu_available}
575753
HIP runtime version: {hip_runtime_version}
576754
MIOpen runtime version: {miopen_runtime_version}
577755
Is XNNPACK available: {is_xnnpack_available}

0 commit comments

Comments
 (0)