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.

https://www.youtube.com/watch?v=8NtHDkUoN98

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