kernel running makes windows system unresponsive

I am running on WinXP, I’ve got a kernel which would take normally about 10 seconds to execute. During execution, the system is unresponsive… no screen updates, mouse clicks don’t register, windows don’t update, etc, until after the 10 second period is over.

Since I use my GPU (GTX 285) also as my graphics adapter, I cannot let it run for more than 5 seconds or Windows will shut it down (timeout). So I have divided my kernel into multiple kernel calls. I use streams to launch these kernels all at once, and wait for them to be finished.

cudaStream_t stream;	cutilSafeCall( cudaStreamCreate(&stream) );

	cudaEvent_t stop_event;	cutilSafeCall( cudaEventCreate(&stop_event) );

	for ( int part=0; part<num_partitions; part++ )

	{

		// Queue up all the kernels, run them in order

		my_kernel<<<dimGrid, dimBlock, 0, stream>>> (params, part);	

	}

	cudaEventRecord(stop_event, 0);

	cudaEventSynchronize(stop_event);

I imagine that somehow CUDA may be monopolizing the GPU during this time such that Windows cannot use it? Is there anything I can do to allow windows to be more responsive during long kernel execution?

I changed the code a bit to get rid of streaming:

for ( int part=0; part<num_partitions; part++ )

	{

		// Queue up all the kernels, run them in order

		my_kernel<<<dimGrid, dimBlock>>> (params, part);	

	}

I run the kernel about 50 times, each kernel takes about 200msec, so the total time is about 10 seconds. Even though each kernel lasts no longer than 200msec, my system is still unresponsive for the entire 10 seconds. Any suggestions?

Unfortunately I think you are recommended to get a second cheap card.

A cudaThreadSynchronize() in the loop after the kernel invocation(s) should stop CUDA queuing up too much work at once.

Thank you, this helps very much!

I used this idea, and also included a short sleep statement to give the GPU a chance to breath, and this improves the system response quite a bit.

cudaThreadSynchronize();

		Sleep(5);