Advanced API Performance: SetStablePowerState

Originally published at:

This post covers best practices for using SetStablePowerState on NVIDIA GPUs. To get a high and consistent frame rate in your applications, see all Advanced API Performance tips.

Thanks for the post!
After many tries, this use of nvidia-smi --lock functions gave us the persistent performance the project requires

It is very useful APIs when using the GPU as a DSP that need to work without any frequency lowering / idle behavior

Related to this post,
can you explain the different usage of the following Performance approaches:

  1. Use “Nvidia Control Panel” GUI settings

  2. Use nvidia-smi command line calls

  3. Use nvml CUDA API

I prefers to use NVML to get the GPU persistent behavior, is it possible to get such persistent behavior only using nvml on GeForce RTX 3050 ?


That’s great news.

Did you encounter differences between the article’s recommendations and your usage? I’d like to update it to match current uses. nvidia-smi isn’t guaranteed to be a fixed target, unfortunately and it’s been a while since I wrote this article!

Thanks, Ryan

Hello again-

I’m not familiar with what you’re referring to with 1/control panel, can you elaborate?

I’m also not certain about the differences between 2 and 3. I suspect on the backend they are poking the same driver components to achieve their goals, because there’s basically one place to set these things. Unfortunately, the best way in the near term to establish this is probably to do a bit of testing.

I’ll try to find the maintainers of these routes and report back if/when I get definitive answers.

Thanks, Ryan

This sequence from the post works perfectly to set GPU core & GPU memory clock frequencies

nvidia-smi --query-supported-clocks=timestamp,gpu_name,gpu_uuid,memory,graphics --format=csv`
nvidia-smi --lock-gpu-clocks=<core_clock_rate_from_csv>
nvidia-smi --lock-memory-clocks=<memory_clock_rate_from_csv>

There is additional GPU performance option on:
Windows → “Nvidia Control Panel” → “3D setting” → “Manage 3D setting” → “Global Setting” / “Program Setting” → “Power management mode” = “Prefer maximum performance”

Ah, I would not rely on that setting. That’s more of a behavioral suggestion, it doesn’t pin the frequencies.

Excellent, so it looks like the commands are the same. Thanks!