nan0s7 / nfancurve

A small and lightweight POSIX script for using a custom fan curve in Linux for those with an Nvidia GPU.
GNU General Public License v3.0
314 stars 57 forks source link

tuning of fcurve, tcurve behavoir #15

Closed swi2012 closed 5 years ago

swi2012 commented 5 years ago

Hello. First i must say your script is a savior! I've tried now to tune fan curve with your script, ut can't figure out how i've change to declare -a fcurve=( "0" "20" "40" "50" "70" ) # fan speeds declare -a tcurve=( "35" "45" "55" "65" "75" ) # temperatures as i understand from comment in config file if temp raise above 35 it will set fan speed to 20%, if above 45 - raise fan speed to 40 and so on, but when i monitoring with nvidia-setting gui i can see that it does not turn fan up until 45-46*. Maybe i get a wrong idea?

nan0s7 commented 5 years ago

Thank you! I'm glad it's helpful :D

Hmm that's strange. That may be my bad with how I've explained each function in the comments of the config file. The script checks the min_t value before the tcurve value. I intended the fcurve to not have any zero values, mainly to allow for a smoother curve.

So if you want to keep the settings the way they are, you can remove the first element in your fcurve and tcurve, and set your min_t to be 35.

declare -a fcurve=( "20" "40" "50" "70" ) declare -a tcurve=( "45" "55" "65" "75" )

If that doesn't work, feel free to reply here. I'd like to know what GPU you're using, and if you can, post the output of the script. Thank you! :)

swi2012 commented 5 years ago

Thank you for reply. now i have min_t ="35" and eclare -a fcurve=( "20" "40" "50" "70" ) declare -a tcurve=( "45" "55" "65" "75" )

then i run temp.sh and have output like this

(nvidia-settings:7314): Gdk-WARNING **: 09:13:20.707: The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3. See the documentation for gdk_window_ensure_native() on how to get native windows. t=46 oldt=44 tdiff=2 slp=7 gpu=0 nspd?=40 nspd=20 cd=10 maxt=75 cd2=7 mint=35 oldspd=20 fan=0 z=no

(nvidia-settings:7326): Gdk-WARNING **: 09:13:27.774: The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3. See the documentation for gdk_window_ensure_native() on how to get native windows. t=47 oldt=44 tdiff=3 slp=7 gpu=0 nspd?=40 nspd=20 cd=10 maxt=75 cd2=7 mint=35 oldspd=20 fan=0 z=no

but according to nvidia-settings gui fan speed remain on 0%. I have asus dual 1060

and then i restart script, it turn fan on 40 and then (nvidia-settings:8689): Gdk-WARNING **: 09:21:42.401: The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3. See the documentation for gdk_window_ensure_native() on how to get native windows.

Attribute 'GPUTargetFanSpeed' (home:1[fan:0]) assigned value 20.

t=35 oldt=46 tdiff=11 slp=7 gpu=0
nspd?=20 nspd=20 cd=10 maxt=75
cd2=7 mint=35 oldspd=40 fan=0 z=yes

it reduce fan to 20

nan0s7 commented 5 years ago

Oh so you have two 1060's? Can I see the whole output of my script too? There's important information at the beginning that helps with figuring out the problem. If you have two GPU's you may need to adjust the bottom of the config file too. My script should have detected all of your GPU's correctly.

The part where you say it changed the fan speed to 20% means it's working fine. It says the temperature at that time was 35 degrees, so even though min_t=35, it won't make the fan speed go to 0% just yet as it needs to go below 35.

The error you're seeing about the GDK Warning isn't an error for my script. It means that you're missing a package for the nvidia-settings program as far as I'm aware. It's nothing too important though, everything is still working normally. :)

swi2012 commented 5 years ago

No no, it one GPU, it's model name https://www.asus.com/Graphics-Cards/DUAL-GTX1060-6G/ :) Sems like it' now work with my new curves. I'll monitor it a bit longer in the games too.

nan0s7 commented 5 years ago

Ah okay, let me know how it goes! :)

swi2012 commented 5 years ago

well, i dont understand logic. Right now i have temp of gpu 32*, but fan still not 0% (mint=35). I've tried to understand the way you calculate when to change speed reading temp.sh file, but can't figure it out. As i observer temp and fan speed it' seems like it trigger change of fan speed like this:

nan0s7 commented 5 years ago

I think you're understanding the logic correctly, however, to make my script more power-efficient I've added the long_t and short_t variables (which you can also change in the config if you need to. Basically what they do is keep track of the change in temperature, and if the difference is not bigger than long_t then it won't bother changing the fan speeds.

So I think what is happening with your case is that the script has recently changed the fan speed when the temperature is close to 35, thus resetting the temperature difference number to zero. Then the temperature has gone below 35, but it hasn't gone low enough to tell my script to change the fan speed again. I hope that makes sense.

Here is an exerpt of the logic my script uses (in the loop_cmds() function)

get_absolute_tdiff

if [ "$tdiff" -le "$chd1" ]; then
    set_sleep "$long_s"
elif [ "$tdiff" -lt "$chd2" ]; then
    set_sleep "$short_s"
else

Basically what happens is it calculates the change in temperature, then compares it to the long and short values in the config file. After the "else" part, is when the script will change the fan speed.

You could try reducing the values of long and short by one, but that will make the script use more power in the background because it just means it's checking the temperature more frequently.

Personally I'd keep fiddling around with the tcurve and fcurve values until you're more happy with the behaviour.

Hope that helps you! :)

swi2012 commented 5 years ago

Thanks for a long answer! I'd missed long_t, short_d var. Now the logic is clear. My curve as it now allmost perfect, just tune a little mint and first value in tcurve :)