What will happen with infinite loops ?

Hello,

Suppose a cuda kernel/cuda thread is executing the following code:

while (1==1)
{
a = a + 1;
}

What will happen to the cuda core that is executing this infinite thread/loop.

Will this cuda core execute this thread only ? or will the cuda core switch to other threads to execute ?

So what is the executing model of cuda and the hardware ?

Does it constantly switch to other threads, or will it try to execute a single thread for as long as possible until a memory stall happens (in the latter case if the memory stall never happens then the cuda kernel would hang indefinetly) ?

Bye,
Skybuck.

According to this article:

The threads are time sliced, is this indeed true for compute 2.1 ? External Image (It’s a bit old article from 2008 External Image)

Anyway… if true… then I kinda wonder how long such a time slice would be ? External Image