How to Lock Nvidia GPU Clock and Power Limit Under Windows with Nvidia-smi
The Nvidia System Management Interface (nvidia-smi) is a command line utility, based on top of the Nvidia Management Library (NVML), intended to aid in the management and monitoring of Nvidia GPU devices. It has a number of useful commands for mostly monitoring the status of your Nvidia GPUs, but there are some commands that can be useful for miners as well. There are two commands that we’ll be discussing here now that can be useful to help you optimize your mining performance and while here the focus is for use under Windows, the nvidia-smi tool is also available for Linux and can be used there as well. We’ll be learning how to lock the operating frequency of an Nvidia GPU to a certain fixed value as well as how to control the power limit of that particular GPU as well and how these two commands can complement each other well in order to optimize the performance and energy efficiency of a mining rig based on Nvidia GPUs.
Fixing or locking the GPU frequency to a certain level or the power limit on an Nvidia GPU with the nvidia-smi tool on Windows requires you to start a “Command Prompt” window, but make sure you do so with Administrator privileges, otherwise you will not be able to change anything as you would not have the required permissions. The nvidia-smi tool should be included in the Path, so no need to run it from a specific location, though you might want to run it from a Batch (BAT) file in order to automate it with the start of a miner for instance. Since it requires Admin privileges you cannot set the Batch file to be executed as Admin by default, but if you make a Shortcut to the BAT file you can set the Shortcut in Windows to be ran as Administrator and that would do the job.
To set the GPU clock on Nvidia GPU using the nvidia-smi tool you need to use the
-lgc parameter. So, for example to set the GPU clock to 1050 MHz you would need to run
nvidia-smi -lgc 1050 as on the example screenshot above. Do note that this will be the GPU clock that your Nvidia graphic adapter(s) will be running at ONLY if they are allowed to by their power limiter at the moment, but more on that in a moment.
To set the GPU Power Limit on Nvidia GPU using the nvidia-smi tool you need to use the
-pl parameter. So, for example to set the GPU Power Limit to 120W you would need to run
nvidia-smi -pl 120 as on the example screenshot above. When set the Power Limit is fixed regardless of other options of the GPU.
In our example above we have set the GPU clock to 1050 MHz and the Power Limit to 120W for a mining rig with 6x Nvidia RTX 3070 GPUs, but as you can see from the NBMiner screenshot here the operating frequency is lower than the set value while the Power Limit is also reported 119W instead of 120W, but small variation here is normal. Well, the thing is that at 120W of power usage as per our limit here the said GPUs are just not able to function with such high GPU clock, but if we increase the power limit a bit more the video cards will be able to operate at 1050 MHz clock without a problem. So, what you need to make sure you do is to match well both of these parameters in order to get optimal performance with optimal power usage…
If you set the power limit to let us say 150W, but the GPU clock limit is at 1050 MHz the video cards will just consume around 130-135W and not the full 150 Watts. The trick here is to first see what GPU clock you need for the optimal performance of a certain video card, like for example the RTX 3070 (depending on the make and model and operating conditions) can require somewhere between around 850 and 1050 MHz GPU clock to give you 60 MHs of Ethash mining hashrate with 120W-130W of power usage as maximum. You just need to play around with your specific hardware a bit and see what works best and then you can automate the settings for optimal performance and power usage via the batch file you use to run your mining software.