5

So I was trying to figure out how to make a custom fan curve for my Gigabyte GTX 960 ITX card. It is about half-length (for my small case) but that means it has a very small heat sink, and the Nvidia driver wasn't properly compensating for that.

I did a bunch of googling, and most of the answers didn't really work for some reason.

How can I make a custom fan curve?

3 Answers 3

6

I found the bulk of my answer on Ubuntu Forums but the command to set the fan speed given was wrong. I also wrote the shell script myself (and I'm a noob), so feel free to comment how I did everything wrong, as long as you tell me how to fix it :) I added excessive comments so people who don't understand bash can get an idea of what I'm doing. This only works for 1 GPU, and will need modifications for multiple. By the way, the fan curve I have set is speed%=0.028*(degreesC^2).

Set-up

  1. Run your file browser of choice as root (in my case sudo konqueror).
  2. Go to /etc/X11 and allow write access to all groups (but keep the window open).
  3. Open up the Nvidia X server settings window (nvidia-settings in the terminal).
  4. Go to the nvidia-settings configuration.
  5. Click Save Current Configuration and then click save on the pop-up window.
  6. Close Nvidia Settings and run sudo nvidia-xconfig, then again with --cool-bits=4.
  7. Reboot.

Script

#!/bin/bash
# Put "sleep 30" here if you run it at start-up
# to make sure this starts after the Nvidia driver does.

fan="0"
gpu="0"
echo "GPU fan controller service started."
nvidia-settings -a "[gpu:$gpu]/GPUFanControlState=1" > /dev/null
check="$(nvidia-settings -a \"[fan:$fan]/GPUTargetFanSpeed=30\" | tr -d '[[:space:]]')"
working="Attribute'GPUTargetFanSpeed'($(hostname):0fan:$fan)assignedvalue30."

if [[ "$check" != "$working" ]]; then
    echo "error on fan speed assignment: $check"
    echo "Should be: $working"
    exit 1
fi
while true
do
    degreesC="$(nvidia-smi -i $gpu | grep -owEe '[0-9]+C')"
    fanSpeed=$(($degreesC ** 2))
    fanSpeed=$(($fanSpeed / 50))
    if [[ $fanSpeed -gt 100 ]]
    then
        fanSpeed=100
    fi
    nvidia-settings -a "[fan:$fan]/GPUTargetFanSpeed=$fanSpeed" > /dev/null
    sleep 8
done

I probably won't be updating this in the future, as I'll be upgrading to an RX 480.

2

I made my own script for this and its the best I have seen so far. I'm hoping some of you will contribute and improve my code. Mine works just by running it and should be able to support older versions under 349.16. It also has an adjustable fan curve.

Heres the github link: https://github.com/abc123me/Nvidia-Fancontrol

1
  • 1
    For those using a headless machine, you probably won't be able to use this as it relies on the DISPLAY OS environment variable / X window.
    – OscarVanL
    Nov 6, 2020 at 12:49
0

Thanks for the script. I am having issues with one of fan's controllers, what brakes hardware fan control (Second fan is not recognized, first starts spinning like crazy.). Software control works well on Windows, so I decided to check how to implement software control with fan curve on Ubuntu.

Anyway, the reason I am typing this is because you have hard coded your computer's name in script (Line 4: Bens-PC). It would be better to use a variable, and comment the script so people can easier notice it.

0

You must log in to answer this question.