Ensuring windows doesn't kill long kernels

I have problems with kernels taking too long and the driver being killed by the windows watchdog timer. What is the general method to avoid stalling the GPU driver or reducing the kernel time without sacrificing performance.

If you have a Tesla GPU use the TCC driver (which is faster and will not time out).

Otherwise this video shows you exactly how to set the timeout.

[url]NVIDIA CUDA Tutorial 3: Display Driver has Stopped Working and has Recovered - YouTube

BTW the same thing happens in linux if the same GPU used for calculations has the video out.