Skip to content

Commit 8effcd9

Browse files
committed
Hotfix: do not raise exception if GPU frequency unsupported
1 parent 4808994 commit 8effcd9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

library/sensors/sensors_python.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,15 @@ def fan_percent() -> float:
386386

387387
@staticmethod
388388
def frequency() -> float:
389-
if pyamdgpuinfo:
390-
pyamdgpuinfo.detect_gpus()
391-
return pyamdgpuinfo.get_gpu(0).query_sclk() / 1000000
392-
elif pyadl:
393-
return pyadl.ADLManager.getInstance().getDevices()[0].getCurrentEngineClock()
394-
else:
389+
try:
390+
if pyamdgpuinfo:
391+
pyamdgpuinfo.detect_gpus()
392+
return pyamdgpuinfo.get_gpu(0).query_sclk() / 1000000
393+
elif pyadl:
394+
return pyadl.ADLManager.getInstance().getDevices()[0].getCurrentEngineClock()
395+
else:
396+
return math.nan
397+
except:
395398
return math.nan
396399

397400
@staticmethod

0 commit comments

Comments
 (0)