Posts Tagged ‘Nvidia force power state

nvidia-smi-power-limit

There are a number of tools available that can allow you to monitor and control various aspects of your GPU and most fo them do come with nice graphical user interface to make things simple. When mining however you might want to have easy console command control over the GPU behavior to be able to execute commands that change things from a Batch file fro example right before a given miner software is stated. For Nvidia GPUs there is the Nvidia System Management Interface (nvidia-smi) command line utility that can help you do that in a simple and effective way, we have already showed an example using it to control the power state of the GPUs for getting some extra performance with non-overclocked video cards that are not running at the maximum power state when doing compute tasks such as mining for crypto currencies. Now it is time to show you some more useful tricks for using the nvidia-smi to check and modify the maximum TDP (Power Limit) that a given GPU can use as well as how to monitor constantly the GPU temperature and power usage and possibly log them in a file if you need that recorded for some further analysis.

The nvidia-smi utility is part of the video drivers and you can find it installed in the folder “C:\Program Files\NVIDIA Corporation\NVSMI\” on Windows, so you need to run the command line (cmd) and navigate to that folder in order to be able to issue commands. You then need to run nvidia-smi with some specific parameters based on what you need it to do such as specifying which GPU you need to play with by ID and then the command that needs to be sent or the data read from it.

So if you want to see what is the power limit of the first Nvidia GPU in the system:

nvidia-smi -i 0 --format=csv --query-gpu=power.limit

If you do not include the i parameter followed by the GPU ID you will get the power limit of all of the available video cards, respectively with a different number you get the details for the specified GPU. Then comes the fun part, changing the power limit to a lower value in order to reduce power consumption without affecting the performance or with slight decrease to get better power efficiency while mining. So in the following example we set the power limit to 175W for the first GPU down from the maximum of 275W that is has preset in the BIOS:

nvidia-smi -i 0 -pl 175

nvidia-smi-temperature-report

The next useful thing we want to be able to do via the console is to check the temperature of an Nvidia GPU and have it reported each second with the ability to also save the results in a text file should we need to do some additional analysis of the results. Using nvidia-smi to read the temperature of the first GPU each 1000 ms (1 second) can be done with the following command:

nvidia-smi -i 0 --loop-ms=1000 --format=csv,noheader --query-gpu=temperature.gpu

In order to stop the reporting of the temperature in degrees Celsius you need to press CTRL + C. If you need to have the result recorded to a text file you can run the following command:

nvidia-smi -i 0 --loop-ms=1000 --format=csv,noheader --query-gpu=temperature.gpu > temperature.txt

nvidia-smi-power-usage

The same way you can get the temperature of a GPU in the system reported you can also have a report on the current power draw of each Nvidia GPU in Watts for example every second. The reporting of power usage is very accurate and does not require any hardware as it is already implemented on a hardware level in the more recent Nvidia-based video cards. What you need to do is to run the following command:

nvidia-smi -i 0 --loop-ms=1000 --format=csv,noheader --query-gpu=power.draw

In order to stop the reporting of the temperature in degrees Celisus you need to press CTRL + C. If you need to have the result recorded to a text file you can run the following command:

nvidia-smi -i 0 --loop-ms=1000 --format=csv,noheader --query-gpu=power.draw > powerusage.txt

The reporting of the current power usage can be very helpful when tweaking your Nvidia-based video card for achieving the best power usage / mining performance ratio and also in order to compare power usage between different crypto algorithms. The nvidia-smi tool has some other useful features that may be handy for users, do note however that the changes you make with it are not permanent, they will need reapplying if you restart your computer, but you can automate them with a simple batch file by running a command right before you start up your miner software.

nvidia-smi-p2-power-state

There is a little trick that can help you get some extra hashrate out of your Nvidia GPU when mining Ethereum or another more memory dependent algorithm, though it will most likely not affect many of the other crypto algorithms. By default when running Compute applications on your GPU it does not go to the highest Power State of the card, meaning that you might not be able to squeeze the maximum performance out of the video card and that is without overclocking anything. Thanks to the Nvidia System Management Interface (nvidia-smi) command line utility you are able to force the GPU to work in P0 state (the highest power state) instead of staying at maximum P2 when running a Compute applications such as a crypto miner software. Do note that this specific lower maximum power state is only for Compute applications, so it is not needed, not it should affect gaming performance where the GPU shuld go up to P0 power state if the conditions allow it.

The nvidia-smi utility is part of the video drivers and you can find it installed in the folder “C:\Program Files\NVIDIA Corporation\NVSMI\” on Windows, so you need to run the command line (cmd) and navigate to that folder in order to be able to issue commands. What you should start with is running the following command to check the current P-state of your GPU(s):

nvidia-smi -q -d PERFORMANCE

Do note that the P-state changes dynamically, so you need to be running Ethminer or another application when you issue the above command to see the power state active under load, otherwise you might see a lower power state being active if the GPU is idle.

nvidia-smi-p0-operating-frequencies

After you verify the maximum power state that your Nvidia GPUs use when executing Compute applications such as ones that rely on OpenCL or CUDA you need to check what are the maximum frequencies of the video card that are available for the maximum performance in the P0 power state. You can do so with the following command (make sure you are still in the NVSMI folder):

nvidia-smi -q -d SUPPORTED_CLOCKS | more

The above will list all of the supported frequencies in the different power states that your video card can use, but there is no need to check the complete list. All we need to note are the frequencies at the top of the list for the Memory and the Graphics, in this example we are using GTX 970 video card from Gigabyte and the values we need are 3505 MHz for the VRAM and 1455 MHz for the GPU. We’ll need these frequencies for the next step.

nvidia-smi-p0-power-state-activated

What we are going to do next is to force the video card to use the maximum performance operating frequencies by going to the P0 power state. In order to do that we need to run the following command:

nvidia-smi -ac 3505,1455

Note that the above command will apply the settings to all GPUs that you have in your system, normally that should not be a problem for most mining rigs as they are usually with a number of cards that are the same model, but there are cases when this is not true. So you might need to check the individual settings fro different video cards and apply the correct parameters for each of them separately. To do so you just need to add the card ID in the command line, so that the particular option will be executed only for the specified video card. This is being done by adding the “-i ” parameter to the command line where can be a number starting from 0 for the first GPU and so on. In the example shown on the screenshot above we have two different GPUs in the system, so wee need to set their P0 power states with two separate commands identifying each of the card separately:

nvidia-smi -i 0 -ac 3505,1455
nvidia-smi -i 1 -ac 3505,1392

The question that undoubtedly comes now is how we have increased the performance for mining Ethereum by following the instructions above. Well it is pretty easy to check by running a benchmark with Ethminer, or just running the miner and noting the new increased frequencies that you should now have and compare them to the ones you previously had. On the Nvidia Gigabyte GTX 970 WF3OC video card used in the guide we are normally getting about 17.31 MHS in terms of hashrate mining Ethereum when the GPU is maxing out at the P2 power state, when we force it to go to the P0 power state the hashrate increases to about 19.98 MHS. So this is a nice improvement in terms of performance that comes at a cost of just about 10W higher power usage from the video card. Do note however that while this will work with Ethereum for increasing performance due to the heavy usage of video memory in the mining process, doing it may not bring performance improvement in many other commonly used mining algorithms.


top