unpredictable launch failed problem

hello guys,

I’m writing a cuda program under windows xp with visual studio.

the program runs fine in the debug mode, but now i need to test the performance, so i compiled it into the release mode. however, unpredictable CUDA_LAUNCH_FAILED problem happens. each time, it happens on different cuda function call at different time.

i have noticed that, there are few lines in my code:

		right=1;
		
	
		for(i=10;i>=right;--i)
		{
			list[i*2]=list[(i-1)*2];
			list[i*2+1]=list[(i-1)*2+1];
		}

if i replace “right” with the constant number 1, the program will not generate the CUDA_LAUNCH_FAILED problem.

I don’t know if this has things to do with the loop unroll of the cuda compiler. but i have already disabled any optimization.

i don’t know how to debug this, since it happens differently each time and is fine under the debug mode.

do you have any suggestion?

thank you so much.

it may be out-of-array bound.

suppose the error is out-of-array bound, then you can check this.

for example, allocate larger device memory (if you need to deal with an array with size 100M, then you can allocate 200M) and
check if the error occurs or not.