Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nanom1t/1c991172035b1d1d5c6e58e7aac55937 to your computer and use it in GitHub Desktop.
Save nanom1t/1c991172035b1d1d5c6e58e7aac55937 to your computer and use it in GitHub Desktop.
Set and get power limit under Linux for NVIDIA cards

Get device numbers

$ nvidia-smi -L
GPU 0: GeForce GTX 1070 (UUID: GPU-2a97b3b6-2318-aa98-f163-d164eb9d54fd)
GPU 1: GeForce GTX 1070 Ti (UUID: GPU-d2085209-9bc9-f2ac-9983-dd7b4a0627dd)
GPU 2: TITAN Xp COLLECTORS EDITION (UUID: GPU-1334cd53-38d9-7e44-4634-6e8290de0795)

Set maximum power limit

$ nvidia-smi -pm 1
$ nvidia-smi -i 2 -pl 250 # (this is maximum power for Titan XP) 

Get the power limits

$ nvidia-smi

Sat Jan 27 21:43:06 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 387.34                 Driver Version: 387.34                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 106...  On   | 00000000:1B:00.0  On |                  N/A |
| 19%   61C    P2    63W /  66W |   3113MiB /  6072MiB |    100%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1376      G   ...-token=35CDE0117AA413AB0BB8437F9F3E8199   120MiB |
|    0      2878      G   /usr/lib/xorg/Xorg                           366MiB |
|    0     23392      C   /usr/local/bin/ethminer                     2457MiB |
|    0     23485      G   kwin_x11                                      28MiB |
|    0     23491      G   /usr/bin/krunner                               1MiB |
|    0     23493      G   /usr/bin/plasmashell                          71MiB |
|    0     24013      G   ...-token=00F728BD67903F2B709DBC883266067E    21MiB |
|    0     24546      G   ...ra/.local/share/Steam/ubuntu12_32/steam    32MiB |
+-----------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment