Nvidia Fan Speed Script for Linux

(lfrisken) #1

I created a script to control the fan speed of nvidia gpus in linux using a custom fan_speed vs temperature curve. I found this feature in msi afterburner really useful when conducting long renders or preview sessions in cycles. Unfortunately no such feature exists in linux. I’ve decided to share this script now after a while, and created a video explaining how to set it up.

Some situations where you might want to use this:

  • your gpu is too loud, more than it needs to be
  • your gpu is getting hotter than you’d like it to. this script can force it
    to run cooler, which is great for longer renders. AFAIK Running your card cooler can
    reduce the wear, and increase its lifespan.
    http://www.ece.cmu.edu/~koopman/des_s99/electronic_electrical/#main_stress
  • When you are using:
    cards with stock cooling
    cards in sli (although I havn’t added support for multiple gpu’s yet)
    small case
    are usually a good indication when you need to check how your card is performing thermally.
  • no need to adjust the fan speed manually, script adjusts it according to situation.

web page:
http://code.google.com/p/nvidia-fanspeed/

video tutorial:

also, you might notice that my current triple slot card runs at 65c when using default nvidia fan settings. This is probably fine, and this script is not needed. But my previous card, with it’s stock cooler, and small case easily approached 75 degrees during long renders and on hot days.

If you want the script to work well, I highly recommend taking the time to adjust the curve to suit your own card and your own preferences about heat and noise levels.

Please feel free to post if you have a fix for some of the smaller bugs that exist in it, but it should be very usable if the instructions are followed.
The instructions are fairly specific to the 500/400 series, so I’m not sure whether it will work with earlier cards, but one can always give it a go :wink: (I’m pretty sure you might not even need to edit xorg.conf with 200 series cards).

I forgot to include explanation about how to edit the fan curve yourself, but there is a lengthy comment in the code for that, which will hopefully suffice. I’m considering creating a simple pyside interface for doing this at some stage if this tool is popular enough :slight_smile:

(holyenigma74) #2

the reason why Linux has only 1% of Desktop market share. LOL
this guy is a programmer and look at the difficulty.

http://marketshare.hitslink.com/operating-system-market-share.aspx?qprid=10&qpcustomd=0

(lfrisken) #3

I went to the effort of making this script and publishing it for other people to use… I’m not exactly sure how to take that comment, but I’ll assume you’re not trolling or whatever, and are just making a joke about how few people use linux. Also, fyi, cycles runs a good deal faster in linux, which for me is enough just to use linux while doing rendering and render setups.

(holyenigma74) #4

im just playing around…

Linux person, “We are the 1%!!!:stuck_out_tongue:

(ikeahloe) #5

nice of you to share your script sir!

i’m also not sure how linux’s marketshare is relevant here. a first draft of a personal script that somebody makes is going to be as equally complicated on any OS…

(lfrisken) #6

haha :smiley: ok! But… check out this
https://docs.google.com/spreadsheet/ccc?key=0As2oZAgjSqDCdElkM3l6VTdRQjhTRWhpVS1hZmV3OGc#gid=0
According to this are almost as many linux users as windows when it comes to blender/cycles! (well at least the ones who are concerned about performance)

(condar) #7

for monitoring my GPU in console, I use nvidia-smi

#!/bin/bash

watch --interval 1 nvidia-smi -q -d MEMORY,TEMPERATURE,COMPUTE
just save it as nvidia_monotir.sh and then run it

(holyenigma74) #8

I dual boot linux and windows i was just messing with you.
(mostly critiquing the video presentation)

if your car was malfunctioning and you took it to the mechanic
for an estimate and he said…

“ummm… basically… ummm… then you’ll need to tweak…
uhhh ummmm, theres a bug it doesn’t work properly… so…
woops!”

Would you
A. Let that person experiment on your car
or
B. Take it somewhere else for a second opinion

(lfrisken) #9

You’ve got a good point (If I was trying to make money from this). Also, in this case, I, (“the mechanic”), don’t have access to your card/computer hardware/specific case setup, (“car”), so I can’t tweak it for you to achieve the results you want. Thus I mentioned I’ll probably bring in a pyside gui interface for average joe to tweak it themselves without having to open the dreaded text editor to change the values in the curve. Option B isn’t really an option right now :stuck_out_tongue: (unless you are using windows, but that defeats the purpose)
Please remember, some of these problems/bugs stem from the limitations of the Nvidia settings commandline interface.

(risq) #10

Thx for this great script! I use it sucessfully on my Gentoo Box with a MSI GTX 560 TC Twin Frozr II with comes with an annoying default Fan Profile. While in Windows u are able to use control the fan via the Afterburner Tool, there is no way to do this in Linux …until i saw this script. Only problem was that the Card was fixed to minimum 40% fan usage, so i needed to flash an VBIOS with has no under limit. This could be done very easy with the nvflash Tool. Then i played a little with your default temperature profile, its quite good, on my card minimum fan should be @ around 25% but that differs obviously from card to card.

Again: Many THX, great help.

(lfrisken) #11

Hi risq, I’m glad there is someone out there who had the same problems as me who can find some use for this script! Thanks for letting me know you found it ;). Feel free to let me know if you think something needs changing.

(lfrisken) #12

Hey, thanks for that tip!

(ZanQdo) #13

Thanks for this, recently got a couple 480 GTX Supeclocked to replace my single 460 (which was really cool), I’m using them on two different PCs, however I was still worried about the temps reaching 90+ C on an open case which is quite dramatic(?)

I’m now rendering a long scene with manual fan speed set to 80% thanks to your help and temps don’t go over 68C which is quite a reduction!

I might later try your custom curve script too, but this is way better as a start

(lfrisken) #14

Hey there ZanQdo, I am so happy that this was of some use to you! To be honest, the only reason you might want to use the script would be if you’re worried about the noise :slight_smile:

(ZanQdo) #15

Actually i 'm still worried about temp. Specially since our render times tend to take 3 days or so. But i have an idea! what if we make this script an addon for blender. So when rendering we can set it to a defined fan speed percentage and when not it can be set to auto :wink:

(Philippe M.) #16

Sorry to bump this thread, but I just wanted to say thanks for this awesome script - I’m still configuring my Linux Mint 13 setup for Blender work, and the Python script really works wonders on temperatures - I had the GPU fan running at 45% for 70C when on automatic, now I’m getting much better temperatures :smiley: Thanks a million, lfrisken!

(lfrisken) #17

Hey Philippe, No problem! I’m also newly on mint 13, it’s awesome eh :slight_smile:
I just got an email from another guy who was having trouble with the script, and trying to adjust it, so I think I’ll try to make a simple gui with pyside to adjust the fan curve, or perhaps integrate it into blender as a python addon and use some of the curve editing elements I’ve seen in blender such as in sculpt mode. The main problem I see with making it an addon for blender is it requires several steps to install, some of which have nothing at all to do with blender. Also, I’m on holidays and with free time in a couple of weeks, I can get back and finish off the GSOC project :wink:

edit:
and another thing I think might make it not such a good idea as an addon, is the fact that, if you kill blender for whatever reason, or blender crashes and doesn’t exit normally, the manual fan speed control might remain set in nvidia-settings on a low value! I’ve thought about it for a while, but there is no easy way to get around this, short of running some kind of daemon permanently outside of blender to check this doesn’t happen.

(Philippe M.) #18

Have to agree with you there - I never run it within Blender since I also play Minecraft in Mint 13, which can be rather GPU-intensive, so I simply run it in a Guake terminal. Start it up once I log in and it stays out of the way, always running :yes: I think having it as a stand-alone would be more ideal and more versatile since, like you said, having it as an add-on could cause problems if you kill/crash/quit Blender without resetting the fan-speed to automatic in nvidia-settings.

(artPen) #19

Hi Ifrisken,

Thanks for the great skript it works great!!! It is rely helpful, without the script temperature goes until 83C with 60% of fan speed. It looks mental!

I have just a couple of problems.
May be you can help?

I have 3 Nvidia GTX 670. I enabled “Coolbits” “4” option but it works only with one GPU!
How can I correct my xorg.conf and your script to make it work with 3 GPU?

Thank you