You were never here, you didn't see anything..

Nvidia Fan & Temp Control – Part 1


This is part 1 of a multi-part post. I am breaking this one up to make it easier to follow.

In my efforts to manage the temperatures and therefore fan speed of my nvidia graphics cards I have created two scripts. There are two as one step only needs to be performed a single time, while the other is currently tied in to conky so it is run at a set interval and I can see the results. Once I am comfortable with the script work I will drop it from conky and run it on its own as I generally don’t ogle my hardware sensors these days unless something is crashing.

So, step 1, unlock the fan control on each of the GPUs in the system. Originally this would have been done by setting the “CoolBits” option in the xorg.conf file but this is no longer supported in recent driver versions. To do this on more recent driver version you will need to use nvidia-settings and the target the “GPUFanControlState” attribute.

The fan control state has two options of interest, 0 for locked and 1 for variable. In order for the fans to be controlled the state must be set to 1. As I have 3 GPUs in my system I must unlock each of them. To easily get a list the following command can be run from the cli:

nvidia-settings -q all | grep GPUFanControlState

My system gave the following output which indicates all 3 GPUs and the state (currently 1, or unlocked):

Attribute 'GPUFanControlState' (kaon:0[gpu:0]): 1.
    'GPUFanControlState' is a boolean attribute; valid values are: 1 (on/true)
    'GPUFanControlState' can use the following target types: GPU.
Attribute 'GPUFanControlState' (kaon:0[gpu:1]): 1.
    'GPUFanControlState' is a boolean attribute; valid values are: 1 (on/true)
    'GPUFanControlState' can use the following target types: GPU.
Attribute 'GPUFanControlState' (kaon:0[gpu:2]): 1.
    'GPUFanControlState' is a boolean attribute; valid values are: 1 (on/true)
    'GPUFanControlState' can use the following target types: GPU.

From the output you can see three “Attribute” lines, one for each GPU which shows the current state at the very end. At the time of this writing I had already unlocked them so the state is 1 for each.

The nvidia-settings tool is used to get and to set this variable and allows one to string multiple set commands together so you only have to run it once to unlock all the GPUs in a system. I have a simple script in my startup to unlock all the GPUs which calls nvidia-settings one time and looks like this:

#!/bin/bash
# Unlock the GPU fan throttles:
nvidia-settings \
    -a [gpu:0]/GPUFanControlState=1 \
    -a [gpu:1]/GPUFanControlState=1 \
    -a [gpu:2]/GPUFanControlState=1

Name it whatever you see fit (in my case gpu-fan-throttle.sh) and set it to be run at startup. Once this has been run you are free to set the fan speeds as needed… which will come in part 2!

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!