Merge pull request #1279 from JeLuF/pbpdev

Fail gracefully if proc access isn't possible
This commit is contained in:
cmdr2 2023-05-19 17:07:36 +05:30 committed by GitHub
commit 3d99f0dd9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,10 +130,13 @@ def include_cuda_versions(module_versions: tuple) -> tuple:
def is_amd_on_linux():
if os_name == "Linux":
with open("/proc/bus/pci/devices", "r") as f:
device_info = f.read()
if "amdgpu" in device_info and "nvidia" not in device_info:
return True
try:
with open("/proc/bus/pci/devices", "r") as f:
device_info = f.read()
if "amdgpu" in device_info and "nvidia" not in device_info:
return True
except:
return False
return False