天天看點

python監控顯示卡的溫度

python監控顯示卡的溫度
import os
import time
while(1):
    shell_str = "nvidia-smi | grep % | cut -d C -f 1 | cut -d % -f 2"
    result = os.popen(shell_str)
    result_str = result.read().replace(" ","")
    result_str = result_str.split("\n")[:-1]
    print(result_str)
    for i in result_str:
        if int(i) > 75:
            print(i,': warning!!!!! 溫度超過75°')
    time.sleep(5)
           
python監控顯示卡的溫度

繼續閱讀