CUDA program running infinitely Simply, program doesn't end... ever!

Hello guys,

I have a strange behaviour with some of my CUDA (2.0) programs. I use the driver API; in a point of my program I have:

CUDA_FUNC( cuStreamCreate( &stream, 0 ); )

CUDA_FUNC( cuLaunchGridAsync( kernel, grid_size_x, grid_size_y, stream ); )

while( cuStreamQuery( stream ) == CUDA_ERROR_NOT_READY )

    usleep( 1000 );

Well, it seems that that “while” doesn’t ever end. I reuse this code in many similar programs, and the majority of them runs normally, ending in 4-5 seconds. Sometimes, however, a program simply goes on infinitely… I tried to let it run for 4 hours, but it didn’t end.

There are no __syncthreads() in “if” constructs in my code, so I don’t understand why it hangs…