Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
fix: add exception handling to get amd gpu usage (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jan 19, 2024
1 parent 4826e9b commit 7715f94
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyra/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
except ModuleNotFoundError:
pyamdgpu = False
try:
from pyadl import ADLManager
from pyadl import ADLManager, ADLError
except Exception: # cannot import `ADLError` from `pyadl.pyadl`
amd_gpus = range(0) # no amd gpus found
else:
Expand Down Expand Up @@ -151,7 +151,10 @@ def update_gpu():
gpu_load = min(100, gpu.query_load()) # max of 100
else:
name = f'{gpu.adapterName.decode("utf-8")}-{gpu.adapterIndex}' # adapterName is bytes so decode it
gpu_load = min(100, gpu.getCurrentUsage()) # max of 100
try:
gpu_load = min(100, gpu.getCurrentUsage()) # max of 100
except ADLError:
gpu_load = None

if initialized and name:
try:
Expand Down

0 comments on commit 7715f94

Please sign in to comment.