DEV Community

vast cow
vast cow

Posted on

How to Limit NVIDIA GPU Core and Memory Clocks

Linux: Limit Clocks with nvidia-smi

On supported GPUs, you can directly specify the core clock and memory clock ranges. root privileges are required. GPU clock locking is supported on Volta-generation GPUs and later, but depending on the GPU model and driver, you may receive a Not Supported message. (NVIDIA Docs)

1. Check the GPU and Supported Clocks

nvidia-smi -L
sudo nvidia-smi -q -d SUPPORTED_CLOCKS
sudo nvidia-smi -lmi
Enter fullscreen mode Exit fullscreen mode

2. Limit the Core Clock

The following example limits GPU 0 to a minimum of 300 MHz and a maximum of 1500 MHz.

sudo nvidia-smi -i 0 --lock-gpu-clocks=300,1500
Enter fullscreen mode Exit fullscreen mode

To lock it at exactly 1500 MHz:

sudo nvidia-smi -i 0 --lock-gpu-clocks=1500
Enter fullscreen mode Exit fullscreen mode

Specifying a single value locks the GPU to that frequency, making it less likely to downclock while idle. In most cases, specifying a range as min,max is recommended. (NVIDIA Docs)

3. Limit the Memory Clock

Example: set the memory clock range from 810 MHz to 5000 MHz.

sudo nvidia-smi -i 0 --lock-memory-clocks=810,5000
Enter fullscreen mode Exit fullscreen mode

Lock the memory clock at 5000 MHz:

sudo nvidia-smi -i 0 --lock-memory-clocks=5000
Enter fullscreen mode Exit fullscreen mode

Memory clock control is not supported on all GPUs. In addition, Hopper-based GPUs require the deferred-application method instead of the standard --lock-memory-clocks option. (NVIDIA Docs)

4. Monitor the Current State

watch -n 1 'nvidia-smi --query-gpu=index,name,clocks.gr,clocks.mem,power.draw,temperature.gpu --format=csv'
Enter fullscreen mode Exit fullscreen mode

5. Restore the Default Settings

sudo nvidia-smi -i 0 --reset-gpu-clocks
sudo nvidia-smi -i 0 --reset-memory-clocks
Enter fullscreen mode Exit fullscreen mode

If Clock Control Is Not Supported

You can indirectly limit the boost clock by reducing the GPU's power limit.

nvidia-smi -q -d POWER
sudo nvidia-smi -i 0 --power-limit=150
Enter fullscreen mode Exit fullscreen mode

The specified value must fall within the displayed Min Power Limit and Max Power Limit range. (NVIDIA Docs)

Top comments (0)