AMD Set Fan Speed and Other Powerplay Memory/CPU Timings with a Linux script

You can do other things but this particular script is just to set all AMD cards to 80% fan speed (remember this script needs to applied everytime you reboot). You could set it is a cron or just throw it into /etc/rc.local

basepath=/sys/class/drm
for hwmon in `ls -1 /sys/class/drm|grep card[0-99]$`; do
echo card=$hwmon;
hwmonname=`ls $basepath/$hwmon/device/hwmon|grep hwmon[0-99]`
hwmonpath=$basepath/$hwmon/device/hwmon/$hwmonname
echo "echo 1 > $hwmonpath/pwm1_enable"
echo "echo 205 > $hwmonpath/pwm1"
echo 1 > $hwmonpath/pwm1_enable
echo 205 > $hwmonpath/pwm1
done

The way it works is as follows:

The card power play settings are located in:

/sys/class/drm/cardNumber/device/hwmon/hwmonNumber

The card number is also the same order that you'll find in say Claymore and the hwmon number is usually 1 less than your card number.  So as you can see below card4's hwmon path is hwmon3.

In the script I account for that just in case it may be different though.

cat /sys/class/drm/card4/device/hwmon/hwmon3/pwm1_enable
2

#enable pwm (if the value is not 1 it is not enabled so setting the fan speed would have no effect)
echo 1 > /sys/class/drm/card4/device/hwmon/hwmon3/pwm1_enable

The parameters for fan speed are a percentage or number out of max 255.  So 80% would be the number 205 (it also seems to round to the nearest 5% I believe)

 cat /sys/class/drm/card4/device/hwmon/hwmon3/pwm1_max
255
cat /sys/class/drm/card4/device/hwmon/hwmon3/pwm1_min
0


# 210/255 is about 82% fan speed (this still resulted in 80% actual fan speed)
echo "210" > /sys/class/drm/card4/device/hwmon/hwmon3/pwm1

 

The results of higher fan speeds

In one of my test rigs see that on some cards the temperature reduced by about 14C degrees!

Before:

ETH: GPU0 t=72C fan=64%, GPU1 t=72C fan=63%, GPU2 t=69C fan=23%, GPU3 t=84C fan=0%, GPU4 t=69C fan=27%
 

After:

ETH: GPU0 30.457 Mh/s, GPU1 30.455 Mh/s, GPU2 29.473 Mh/s, GPU3 29.498 Mh/s, GPU4 29.484 Mh/s
GPU0 t=65C fan=80%, GPU1 t=71C fan=80%, GPU2 t=55C fan=80%, GPU3 t=57C fan=80%, GPU4 t=55C fan=80%


Tags:

amd, powerplay, cpu, timings, linux, scriptyou, applied, everytime, reboot, cron, etc, rc, basepath, sys, drm, hwmon, ls, grep, echo, hwmonname, hwmonpath, quot, pwm, _enable, follows, settings, located, cardnumber, hwmonnumber, ll, claymore, enable, enabled, parameters, percentage, nearest, _max, _min, resulted, speeds, rigs, reduced, eth, gpu, mh,

Latest Articles

  • How high can a Xeon CPU get?
  • bash fix PATH environment variable "command not found" solution
  • Ubuntu Linux Mint Debian Redhat Youtube Cannot Play HD or 4K videos, dropped frames or high CPU usage with Nvidia or AMD Driver
  • hostapd example configuration for high speed AC on 5GHz using WPA2
  • hostapd how to enable and use WPS to connect wireless devices like printers
  • Dell Server Workstation iDRAC Dead after Firmware Update Solution R720, R320, R730
  • Cloned VM/Server/Computer in Linux won't boot and goes to initramfs busybox Solution
  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint