I have found great tutorial about NVIDIA GPU undervolting on reddit. According to the author it works under Wayland and X11 but I tested it under Wayland only and it works great. I edited some of the text but it isn’t mine. Author: rexpulli
from Reddit: Link
Nvidia doesn’t provide direct access to the voltage value but voltage is still directly tied to the clock: the GPU will auto adjust voltage based on a modifiable curve which binds the two values together (higher clock requires more volts, lower clock requires less volts). If you apply a positive offset to this clock-voltage curve, you force the GPU to use a lower-than-default voltage value for a given clock value, which is effectively an undervolt.
I do this on my 3090 to dramatically lower temperatures for almost no performance loss (I did it on RTX 3060Ti and can confirm that). It’s very easy to do with a Python script which will work in both X11 and Wayland sessions but you need to install a library providing the bindings for the NVIDIA Management Library API.
Install python-nvidia-ml-py
(you can use yay
instead paru
)
paru -S python-nvidia-ml-py
Create Python
script
#!/usr/bin/env python
from pynvml import *
nvmlInit()
device = nvmlDeviceGetHandleByIndex(0)
nvmlDeviceSetGpuLockedClocks(device,210,1695)
nvmlDeviceSetGpcClkVfOffset(device,255)
nvmlDeviceSetPowerManagementLimit(device,315000)
Where:
nvmlDeviceSetGpuLockedClocks
sets minimum and maximum GPU clocks, I need this because my GPU runs at out-of-specification clock values by default because it’s one of those dumb OC edition cards. You can find valid clock values with:
nvidia-smi -q -d SUPPORTED_CLOCKS
but if you’re happy with the maximum clock values of your GPU, you can omit this line.
nvmlDeviceSetGpcClkVfOffset
offsets the curve, this is the actual undervolt. My GPU is stable at +255MHz, you have to find your own value. To clarify again, this doesn’t mean the card will run at a maximum of 1695 + 255 = 1950 MHz, it just means that, for example, at 1695 MHz it will use the voltage that it would’ve used at 1440 MHz before the offset.nvmlDeviceSetPowerManagementLimit
sets the power limit which has nothing to do with undervolting and can be omitted. The GPU will throttle itself (reduce clocks) to stay within this value (in my case 315W).
Save the Python script under name undervolt-nvidia-device
. You can test it running it as root in terminal:
sudo python undervolt-nvidia-device
Once you find the correct values, you can run the script with a systemd service on boot. Create file containing:
[Unit]
Description=Undervolt the first available Nvidia GPU device[Service]
Type=oneshot
ExecStart=/etc/systemd/system/%N[Install]
WantedBy=graphical.target
Save it under name: undervolt-nvidia-device.service
Put both files in /etc/systemd/system
, then reload systemctl:
sudo systemctl daemon-reload
and run service:
sudo systemctl enable --now undervolt-nvidia-device.service
To check how the offsets affect the voltages, you can run in terminal:
watch nvidia-smi -q -d VOLTAGE
while doing some kind of GPU load.