Always put GPU in full speed / P0

I am using Titan X to do some real time video analysis work. The first several compute always takes longer time especially the very first one. I assume this is because the GPU was in Idle or lower performance state? Is there anyway to always put my GPU in full speed or highest performance state (using nvidia-smi maybe)?
I don’t care about the power consumption, I just need speed.

This is an interesting question and I too would be intersted in getting a solution.
Could anyone bring some explanation please ?

A quick research via Google shows that the few related discussions are from 2013/2014…

https://www.google.fr/#q=linux+nvidia+powermizer+set+performance+level

$ nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1

Alternatively, you could edit your xorg.conf and make this change permanent.

Thanks for the tip ! =)

Hi, I wrote a small program to run in the backgroud and keep the card at P2 all the time. Now I can overclock without worrying the card jumping to P0 and crashing.

/*
Keep P2 state permanently

This utility helps overclocked systems not to enter P0 state and crash.

usage: keepP2 [device=N]

Contact petri33 @ setiathome
*/

#include <stdio.h>
//#include <assert.h>
#include <unistd.h>
#include <cuda_runtime.h>
#include <helper_functions.h>
#include <helper_cuda.h>

// a variable in GPU memory
device int i;

global void myKernel(int val)
{
i = 0; // write zero to i
}

int main(int argc, char **argv)
{
int devID;
cudaDeviceProp props;

// This will pick selected or the best possible CUDA capable device
devID = findCudaDevice(argc, (const char **)argv);

//Get GPU information
checkCudaErrors(cudaGetDevice(&devID));
checkCudaErrors(cudaGetDeviceProperties(&props, devID));
printf("Device %d: \"%s\" with Compute %d.%d capability\n", devID, props.name, props.major, props.minor);
printf("Keep in P2 state enabled.\nCreated 2018 by petri33 @ setiathome\n\n");

//minimal Kernel configuration
dim3 dimGrid(1);
dim3 dimBlock(1);

unsigned int microseconds = 100000; // 0.1 seconds

for(;;)
  {
// run 10 times a second, negligible performance hit
myKernel<<<dimGrid, dimBlock>>>(0);
usleep(microseconds);
  }

return EXIT_SUCCESS;

}