Skip to content

Instantly share code, notes, and snippets.

@rail01
Last active March 19, 2022 21:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rail01/eb52060212f0f5f415911ca80c31a2f4 to your computer and use it in GitHub Desktop.
Save rail01/eb52060212f0f5f415911ca80c31a2f4 to your computer and use it in GitHub Desktop.
Make Nvidia GPU performance mode settings permanent on Linux

As many may already know, proprietary nvidia drivers for Linux are far from being perfect, with many options limited or even not present at all. One different case is PowerMizer performance mode, which is present in Linux driver, but its value gets purged after every system reboot and returns back to "Auto".

Fix

In order to fix that it's necessary to create systemD unit that will enroll new setting every time the system is booted. To do that make sure first that your systemD user configuration directory does exist or create one:

$ cd ~/.config/systemd/user/

If instead you get an error saying that the directory does not exist, create it by typing:

$ mkdir -p ~/.config/systemd/user/

And create nvidia-powermizer-fix.service file inside it with the following content:

[Unit]
Description=Enforce Nvidia PowerMizer performance mode on startup
After=graphical.target

[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=<VALUE>"

[Install]
WantedBy=default.target

Where instead of <VALUE> you must insert one of the following numbers:

  • 0 - Adaptive
  • 1 - Prefer Maximum Performance
  • 2 - Auto

Then make sure to reload systemd units and enable your newly created one by running those two commands:

$ systemctl --user daemon-reload
$ systemctl --user enable nvidia-powermizer-fix.service

And reboot your system.

Verifying

To verify that everything worked as expected run the following command:

$ systemctl --user status nvidia-powermizer-fix.service

Expected output should be similar to:

nvidia-settings[584]:   Attribute 'GPUPowerMizerMode' (hostname:0[gpu:0]) assigned value <YOUR VALUE>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment