我组装了一台新台式机,配有 Radeon RX5700 GPU 和 Ubuntu 18.04 系统。GPU 风扇只在我启动电脑时旋转,然后就停止了。使用传感器命令报告错误:
$ sensors
amdgpu-pci-2f00
Adapter: PCI adapter
vddgfx: +0.78 V
ERROR: Can't get value of subfeature fan1_input: I/O error
fan1: N/A (min = 0 RPM, max = 3600 RPM)
edge: N/A (crit = +118.0°C, hyst = +0.0°C)
(emerg = +80000.0°C)
junction: N/A (crit = +80000.0°C, hyst = +0.0°C)
(emerg = +80000.0°C)
mem: N/A (crit = +80000.0°C, hyst = +0.0°C)
(emerg = +80000.0°C)
power1: 8.00 W (cap = 160.00 W)
我不确定这里出了什么问题。有人有解决方案吗?
答案1
您不需要获取风扇速度。风扇控制实用程序在没有任何当前风扇速度信息的情况下工作得很好。您可以通过以下方式安装
sudo apt-get install fancontrol
我的 fancontrol 配置在 /etc/fancontrol 中:
INTERVAL=10
DEVPATH=hwmon2=devices/platform/it87.2608 hwmon3=devices/pci0000:00/0000:00:01.0/0000:01:00.0
DEVNAME=hwmon2=it8728 hwmon3=amdgpu
FCTEMPS=hwmon3/pwm1=hwmon3/temp1_input
FCFANS=hwmon3/pwm1=hwmon2/fan1_input
MINTEMP=hwmon3/pwm1=60
MAXTEMP=hwmon3/pwm1=100
MINSTART=hwmon3/pwm1=60
MINSTOP=hwmon3/pwm1=20
MINPWM=hwmon3/pwm1=0
MAXPWM=hwmon3/pwm1=255
我的机箱在某些频率下会产生共振,因此我编写了一个 Python 脚本来跳过这些频率(风扇转速)。它对我来说非常有效。我在风扇控制上运行它...如果它以某种方式失败,风扇控制将接管...这就是为什么 time.sleep 是 0.25 秒,如果再长一点风扇控制就会启动...
我的python脚本:
import os,time
from subprocess import Popen
from subprocess import PIPE
os.system('echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level')
keepcooling=False
while True:
time.sleep(0.25)
with Popen(["cat","/sys/class/drm/card0/device/hwmon/hwmon3/temp1_input"], stdout=PIPE) as proc:
fantemp=int(proc.stdout.read().decode('ascii'))
temp=fantemp/1000
if temp <=45:
fanpwm=0
if temp >45 and temp <= 75:
fanpwm=temp
if (temp >75 ) and (temp <=95):
fanpwm=temp+55
if temp>95:
fanpwm=200
keepcooling=True; #cool until 80C reached
if temp>=100:
os.system('reboot')
if temp<=80:
keepcooling=False
if keepcooling and temp > 80:
fanpwm=200
print('temp',temp,'fanpwm',int(fanpwm))
os.system('echo '+str(int(fanpwm))+' > /sys/class/drm/card0/device/hwmon/hwmon3/pwm1')
# print('echo '+str(int(fanpwm))+' > /sys/class/drm/card0/device/hwmon/hwmon3/pwm1')
如果要使用它,请小心调整并多次测试。您可以通过 lm-sensors 和 psensor 监控事物……并通过以下方式监控风扇速度
cat /sys/class/drm/card0/device/hwmon/hwmon3/pwm1