Skip to content

Commit

Permalink
Just check /sys/module/amdgpu if initstate not present
Browse files Browse the repository at this point in the history
In case amdgpu is builtin

Closes: #102

Signed-off-by: YiyangWu <xgreenlandforwyy@gmail.com>
  • Loading branch information
littlewu2508 authored and Selene committed Jan 1, 2024
1 parent 8615d09 commit fe96886
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python_smi_tools/rocm_smi.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ def driverInitialized():
"""
driverInitialized = ''
try:
driverInitialized = str(subprocess.check_output("cat /sys/module/amdgpu/initstate |grep live", shell=True))
if os.path.exists("/sys/module/amdgpu") :
if os.path.exists("/sys/module/amdgpu/initstate") :
# amdgpu is loadable module
driverInitialized = str(subprocess.check_output("cat /sys/module/amdgpu/initstate |grep live", shell=True))
else :
driverInitialized = "live" # in case the amdgpu driver is built into ther kernel
else :
driverInitialized = ""
except subprocess.CalledProcessError:
pass
if len(driverInitialized) > 0:
Expand Down

0 comments on commit fe96886

Please sign in to comment.