Jump to content

Reduce NVIDIA RTX idle power in Ubuntu Linux


Go to solution Solved by SimonF,

Recommended Posts

My new server has a NVIDIA RTX2070 Super GPU which was having a relatively high idle power. The link to this topic discusses that and proposes as a solution to run a Windows VM which sets the GPU to use less power.

 

 

Since Windows tends to do a lot of other things in the background I wanted to see if this could be done in a Linux VM as well.

 

As mentioned by @SimonF below, an easier alternative is just setting persistence mode on the GPU:

sudo nvidia-smi --persistence-mode=ENABLED

 

So the information below is just for reference if people come here from a search engine. And it shows the reduced power usage. 🙂 

 

The nvidia-smi tool can show the current performance mode:

Performance State
       The current performance state for the GPU.  
       States range from P0 (maximum performance) to P12 (minimum performance).

See: nvidia-smi docs

 

Mine says P0 which according to the manual is the highest performance which uses 38W while idle:

|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   48C    P0    38W / 215W |      0MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

 

You can change the performance mode using nvidia-settings:

nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2"

See Nvidia-settings docs.

 

Trying to do so results in this error message:

Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run `nvidia-settings --help` for usage information.

 

It requires a graphical user interface which we don't have in the terminal. You can fix this by running a dummy X server as explained here: https://serverfault.com/a/1055788


After doing this my GPU was set to P8 and only uses 20W idle:

|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   36C    P8    20W / 215W |      7MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

 

Aso it runs a bit cooler which is a nice extra. More information and screenshots about the performance mode can be read here: https://rastating.github.io/how-to-permanently-set-nvidia-powermizer-settings-in-ubuntu/

 

Unfortunately I was unable to set it to P12 which should be the minimal power usage. Although it says 20W, my meter only shows around 10-15W extra after adding the GPU. Which is what it should be if I read idle power usage of a RTX2070 super online. Not sure how that is possible.

 

In my experience this is the same as using the Windows VM. But I'd rather run a small Linux VM to keep my GPU idle power to a minimum than running a Windows VM.

 

 

Still looking for a real solution, but until that I'll keep the GPU power to minimum this way when I'm not using it.

 

Edited by Redindian
Link to comment
  • Solution
5 minutes ago, Redindian said:

My new server has a NVIDIA RTX2070 Super GPU which was having a relatively high idle power. The link to this topic discusses that and proposes as a solution to run a Windows VM with the GPU so it will be set to use less power.

 

 

Since Windows tends to do a lot of other things in the background I wanted to see if this could be done in a Linux VM as well.

 

The nvidia-smi tool can show the current performance mode:

"Performance State - The current performance state for the GPU. States range from P0 (maximum performance) to P12 (minimum performance)."

 

See: nvidia-smi docs

 

Mine says P0 which according to the manual is the highest performance which uses 38W while idle:

|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   48C    P0    38W / 215W |      0MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

 

You can change the performance mode using nvidia-settings. But that requires a desktop which we don't have in the terminal. Trying to do so results in this error message:

 

Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run `nvidia-settings --help` for usage information.

 

It requires a graphical user interface which we don't have in the terminal. You can fix this by running a dummy X server as explained here: https://serverfault.com/a/1055788


After doing this my GPU was set to P8 and only uses 20W idle:

|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:04:00.0 Off |                  N/A |
|  0%   36C    P8    20W / 215W |      7MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

 

Aso it runs a bit cooler which is a nice extra. More information and screenshots about the performance mode can be read here: https://rastating.github.io/how-to-permanently-set-nvidia-powermizer-settings-in-ubuntu/

 

Unfortunately I was unable to set it to P12 which should be the minimal power usage. Although it says 20W, my meter only shows around 10-15W extra after adding the GPU. Which is what it should be if I read idle power usage of a RTX2070 super online. Not sure how that is possible.

 

In my experience this is the same as using the Windows VM. But I'd rather run a small Linux VM to keep my GPU idle power to a minimum than running a Windows VM.

 

 

Still looking for a real solution, but until that I'll keep the GPU power to minimum this way when I'm not using it.

 

You can use nvidia-persistenced also

Link to comment
7 minutes ago, SimonF said:

You can use nvidia-persistenced also

 

Thanks, sounds interesting!

 

I'm getting an error on Ubuntu even with sudo:

nvidia-persistenced failed to initialize. Check syslog for more details.

 

And the syslog:

Apr 24 19:20:31 ubuntu nvidia-persistenced: Failed to lock PID file: Resource temporarily unavailable
Apr 24 19:20:31 ubuntu nvidia-persistenced: Shutdown (3457)

 

The manual says you don't need to run it directly and use nvidia-smi:

Once the init script is installed so that the daemon is running, users should not normally
need  to manually interact with nvidia-persistenced: the NVIDIA management utilities, such
as nvidia-smi, can communicate with it automatically as necessary  to  manage  persistence
mode.

 

I was able to set it using:

sudo nvidia-smi --persistence-mode=ENABLED

 

First that increased power usage to 49W. And then it dropped back to 20W. So that seems to be an easier alternative. Thanks!

 

  • Like 1
Link to comment
  • 2 weeks later...

If you are not using the GPU as a passthrough for a VM, but like to use it for Docker you can set it to idle mode as follows.

 

Install the following plugins.

 

NVIDIA drivers: 

https://forums.unraid.net/topic/98978-plugin-nvidia-driver/

 

GPU Statistics: 

https://forums.unraid.net/topic/89453-plugin-gpu-statistics/

 

UserScripts:

https://forums.unraid.net/topic/48286-plugin-ca-user-scripts/

 

You can add the command to run at "First start of Array" only to set the GPU to idle mode on boot. Or any other schedule of course.

 

nvidia-smi --persistence-mode=ENABLED

 

Very nice! 👍

 

 

Screenshot 2023-05-03 at 20.24.01.png

  • Like 1
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...