Ubuntu 20.04 Nvidia GPU Control (FAN, Clock Rate) through ssh terminal

U2 PIA
2 min readJan 29, 2021

Tested on Ubuntu 18.04, 20.04

What U want is

  • Control fan/memory/core speed of your GPU

Precondition

  • You are able to access your system using ssh remotely
  • You have root account
  • You are brave enough to take a risk of breaking your video card or warranty

How to

  1. Enable Coolbits option of X windows

If you skip this step, you can control only one GPU.

$ sudo nvidia-xconfig -a --cool-bits=28

2. Open /usr/share/X11/xorg.conf.d/10-nvidia.conf

$ sudo vi /usr/share/X11/xorg.conf.d/10-nvidia.conf

3. Add “Coolbits” option as followings;

Section "OutputClass"     
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
Option "Coolbits" "28"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
EndSection

4. Reboot

5. Find ‘gdm’ uid, and memorize it.

This step makes it possible to control your GPU without X windows

$ id gdmuid=124(gdm) ...$ sudo ls -AFlh /run/user/124/gdm/.... Xauthority

If you can find the ‘Xauthority’ file, you may say ‘Bingo’.

6. Enable FanControl

use the uid from step 5

$ sudo DISPLAY=:0 XAUTHORITY=/run/user/124/gdm/Xauthority nvidia-settings -a [gpu:0]/GPUFanControlState=1

If no response on this command, you may miss the step 1

7. Control FanSpeed

$ sudo DISPLAY=:0 XAUTHORITY=/run/user/124/gdm/Xauthority nvidia-settings -a [fan:0]/GPUTargetFanSpeed=25

If you get an error message on this command, you may miss the step 1

8. Reset to default (If you want to)

$ sudo DISPLAY=:0 XAUTHORITY=/run/user/124/gdm/Xauthority nvidia-settings -a [gpu:0]/GPUFanControlState=0

9. Control Memory clock, Core clock, Fan Control(reset to auto) at once

$ sudo DISPLAY=:0 XAUTHORITY=/run/user/125/gdm/Xauthority nvidia-settings 
--assign [gpu:0]/GPUFanControlState=0
--assign [gpu:0]/GPUGraphicsClockOffsetAllPerformanceLevels=100
--assign [gpu:0]/GPUMemoryTransferRateOffsetAllPerformanceLevels=750

This command changes core clock +100, memory clock +750 and fan control. Some old articles[Ref.3] recommend to use “GPUGraphicsClockOffset[3]” and “GPUMemoryTransferRateOffset[3]”, but it will not work for PASCAL architecture. [Ref.4]

Done.

References

[1] https://forums.developer.nvidia.com/t/fan-control-ubuntu-18-04/64507/2

[2] http://bailiwick.io/2019/09/21/controlling-nvidia-gpu-fans-on-a-headless-ubuntu-system/

[3] https://bitcointalk.org/index.php?topic=2848723.0

[4] [390.x] Unable to modify GPUMemoryTransferRateOffset and GPUGraphicsClockOffset via nvidia-settings … — GPU Unix Graphics / Linux — NVIDIA Developer Forums

--

--