Skip to content

Commit

Permalink
Fix regex pattern for OD_SCLK and OD_RANGE
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaiasYang authored and honjow committed Feb 19, 2024
1 parent 647cfed commit bf97d1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def checkGPUNeedSet(self, freqMin:int, freqMax:int):
if os.path.exists(GPUFREQ_PATH):
freq_string = open(GPUFREQ_PATH,"r").read()
# 使用正则表达式提取频率信息
od_sclk_matches = re.findall(r"OD_SCLK:\s*0:\s*(\d+)Mhz\s*1:\s*(\d+)Mhz", freq_string)
od_sclk_matches = re.findall(r"OD_SCLK:?\s*0:\s*(\d+)Mhz\s*1:\s*(\d+)Mhz", freq_string)
if od_sclk_matches:
qfreqMin = int(od_sclk_matches[0][0])
qfreqMax = int(od_sclk_matches[0][1])
Expand Down Expand Up @@ -178,7 +178,7 @@ def get_gpuFreqRange(self):
open(GPULEVEL_PATH,'w').write("manual")
freq_string = open(GPUFREQ_PATH,"r").read()
# 使用正则表达式提取频率信息
od_sclk_matches = re.findall(r"OD_RANGE:\s*SCLK:\s*(\d+)Mhz\s*(\d+)Mhz", freq_string)
od_sclk_matches = re.findall(r"OD_RANGE:?\s*SCLK:\s*(\d+)Mhz\s*(\d+)Mhz", freq_string)
logging.debug(f"get_gpuFreqRange {od_sclk_matches[0][0]} {od_sclk_matches[0][1]}")
if od_sclk_matches:
self.gpu_freqRange = [int(od_sclk_matches[0][0]),int(od_sclk_matches[0][1])]
Expand Down

0 comments on commit bf97d1e

Please sign in to comment.