Nvidia GPU set power limit in Linux

Posted on Sat 13 April 2024 by Pavlo Khmel

Enable persistence mode on boot:

systemctl enable nvidia-persistenced
systemctl start nvidia-persistenced

Or enable only for the current session:

nvidia-smi --persistence-mode=1

Current limits

nvidia-smi -q | less
. . .
    GPU Power Readings
        Power Draw                        : 530.09 W
        Current Power Limit               : 700.00 W
        Requested Power Limit             : 700.00 W
        Default Power Limit               : 700.00 W
        Min Power Limit                   : 200.00 W
        Max Power Limit                   : 700.00 W

Change power limit for GPU 0

nvidia-smi -i 0 --power-limit=400

Or for all GPUs

nvidia-smi --power-limit=600

Monitor power usage on GPU 0:

nvidia-smi -q -d POWER -i 0 -l 1 | grep -A 1 "GPU Power Readings"

These changes will disappear after the system reboot. So some script is needed to run on boot if you want to keep these changes after reboot.

Useful links with performance comparison

  • https://www.pugetsystems.com/labs/hpc/quad-rtx3090-gpu-power-limiting-with-systemd-and-nvidia-smi-1983/
  • https://www.pugetsystems.com/labs/hpc/nvidia-gpu-power-limit-vs-performance-2296/