In my previous post, I discussed how to set up your xorg.conf file to allow you to manually control fan speed on headless nVidia cards. Now, I'm going to talk about some command line utilities, and ways to script fan speed control so that you don't have to do it with a GUI every time you want your cards to cool down.
The trick here is that the nvidia-settings utility is actually a very powerful command line tool as well. You can set fan speeds with it very effectively.
The man page for it is a great read, but I'll skip the deep dive into it. Instead, I offer some scripts that you can modify to control your fan speeds!
This will set fans to max:
nvidia-settings -a [gpu:0]/GPUFanControlState=1 -a [fan:0]/GPUCurrentFanSpeed=100 -a [gpu:1]/GPUFanControlState=1 -a [fan:1]/GPUCurrentFanSpeed=100 -a [gpu:2]/GPUFanControlState=1 -a [fan:2]/GPUCurrentFanSpeed=85 -c :0.0
Should you want to set them back to automatic control:
nvidia-settings -a [gpu:0]/GPUFanControlState=0 -a [gpu:1]/GPUFanControlState=0 -a [gpu:2]/GPUFanControlState=0 -c :0.0
You'll need to modify these slightly to match your setup, so I'll go through each command in useful detail.
The '-a' command line option sets an attribute. For fan control, there are two attributes you need to be aware of.
GPUFanControlState enables and disables manual fan control. If it is set to 0, the fans are controlled automatically. If it is set to 1, fans are controlled manually.
GPUCurrentFanSpeed sets the current fan speed, in percent. As I noted in my last post, on my eVGA GTX580, I cannot set the fan speed above 85% - it simply ignores it.
The [gpu:0] and [fan:0] identifiers select which GPU or fan you are setting things on. For modern, single-fan GPUs, they correspond to each other.
Finally, the '-c 0:0' sets the display you are attaching to. I'm not sure why this needs to be set, but it seemed to be required when I was playing around.
So, for my "Set Fans Takeoff Power" script, I go through and sequentially set each GPU to use manual fan control, and then set the fan speed. If you set the fan speed without enabling manual fan control, it doesn't do anything.
For the "Set Fans Autothrottle" script, I simply turn each GPU back to automatic fan control, and the GPU takes over the rest of the work.