Set fan speed without an X server [SOLVED]

I want to run some computations using CUDA, and therefore is desirable to stop the X server to that GPU.
But unfortunately, without a running X server, an user made auto-adjust fan speed script doesn’t work anymore, since nvidia-settings (which is the responsible to set the fan rate) complains about the absence of X server.

The facts:

  • The GPU doesn't have a built-in method to adjust the fan speed automatically, thus an user-made script is needed, since the GPU will work a lot
  • X server must be stopped to use the CUDA debugger and run things smoothly
  • Fan adjust command doesn't work without an X server

To solve this, may then be possible to:

  • Loore nvidia-settings somehow, to force set values on the device?
  • Use nvidia-smi instead?
  • Develop a VBIOS capable of auto-adjust fan speeds?

I’ve been looking around on these 3 subjects last days, with no luck.

I appreciate any help.

The GPU is a GeForce GTX560.

you tried something like the following?

nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUCurrentFanSpeed=n"

and it complains because X isn’t running? would it be possible to launch an X server with only the nvidia-settings running in it at ctrl-alt-f8? something like what they do to launch games in a seperate X server described here:

Run and kill the X server which in its turn runs nvidia-settings.

Something like

X :1 &
export DISPLAY=:1
nvidia-settings your-params
killall X

are the nvidia-setting adjustments retained until the machine is rebooted? killing X doesn’t kill the nvidia-setting adjustments?

Thank you for the answers guys. I found the solution on another forum and, as ubuntuaddicted pointed, it involves running an X server to set speed and maintain a nvidia-smi log to keep a GPU context, so the settings are preserved.

The solution:

This script doesn’t auto-adjusts speeds according to temperature over time, but it allows to have fans at a given fixed speed without an active X server.

I had to make some changes on the provided script to make it work, and also added an option to set whatever speed you like when calling the program. You can download it here:

However this is not the best solution. So, I appreciate anyone who knows any driver related workaround on this subject and post it here.

Here’s a script to do that. It relies on Xorg running, though.

Thanks for the links, they were quite helpful!

I think its still possible to go a bit further and eliminate the X dependency entirely.