# Long Running Kernel Causes Freeze

**URL:** <https://forums.developer.nvidia.com/t/long-running-kernel-causes-freeze/8166>\
**Category:** CUDA Programming and Performance\
**Created:** [March 7, 2009, 10:05pm UTC](https://forums.developer.nvidia.com/t/long-running-kernel-causes-freeze/8166 "2009-03-07T22:05:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elwavero](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@elwavero](https://forums.developer.nvidia.com/u/elwavero)\
**Post date:** [March 7, 2009, 10:05pm UTC](https://forums.developer.nvidia.com/t/long-running-kernel-causes-freeze/8166/1 "2009-03-07T22:05:36Z")

</div>

I read in the CUDA documentation and various forum posts that there is a 5 second time limit for kernels running on cards with an X display attached. I created a test program that launches one kernel with an infinite loop to see how the system reacts to the long running kernel. The following code causes my entire system (running 32-bit Ubuntu 8.04) to freeze, and require a reboot. Is this the expected behavior? I’ve seen several forum posts indicating that a timeout message should be displayed but I am not seeing that.

[codebox]#include \<cuda\_runtime\_api.h\>

#include \<stdio.h\>

**global** void timeout( void )

{

while( 1 ){}

}

int main( int argc, char \*argv )

{

printf( "Invoking kernel… " );

timeout\<\<\< 1, 1 \>\>\>();

printf( “Done\n” );

return 0;

}[/codebox]

---

<div class="post-metadata">

**Author:** ![netllama](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@netllama](https://forums.developer.nvidia.com/u/netllama)\
**Post date:** [March 8, 2009, 4:24pm UTC](https://forums.developer.nvidia.com/t/long-running-kernel-causes-freeze/8166/2 "2009-03-08T16:24:26Z")

</div>

> [@](#):
>
> I read in the CUDA documentation and various forum posts that there is a 5 second time limit for kernels running on cards with an X display attached. I created a test program that launches one kernel with an infinite loop to see how the system reacts to the long running kernel. The following code causes my entire system (running 32-bit Ubuntu 8.04) to freeze, and require a reboot. Is this the expected behavior? I’ve seen several forum posts indicating that a timeout message should be displayed but I am not seeing that.
> 
> [codebox]#include \<cuda\_runtime\_api.h\>
> 
> #include \<stdio.h\>
> 
> **global** void timeout( void )
> 
> {
> 
> while( 1 ){}
> 
> }
> 
> int main( int argc, char \*argv )
> 
> {
> 
> printf( "Invoking kernel… " );
> 
> timeout\<\<\< 1, 1 \>\>\>();
> 
> printf( “Done\n” );
> 
> return 0;
> 
> }[/codebox]

The watchdog timeout behavior will be highly dependent on your particular HW, OS & code. Assuming that this only reproduces with a single GPU while X is running, then this is expected behavior. If it reproduces without X running, then there might be a bug somewhere, and you’ll need to attach an nvidia-bug-report.log from your system.
