I am new to CUDA and would like to ask about what the common reasons for getting Error 702 (CUDA_ERROR_LAUNCH_TIMEOUT) are. I am calling many different kernel functions, and sometimes cuLaunchGrid returns CUDA_SUCCESS but everything after (of which the first call is cuCtxSynchronize, returns the mentioned error.
I read this thread,
according to which some possible reasons might be too many registers/thread, too much shared memory/block or that the kernel runtime exceeds the time allowed.
According to my cubin file I am using at most 12 registers/thread in one of my kernel functions, and since I am using blocks which are 1616, this should be fine
(1616*12 = 3 072 registers/block < 8192, so there is room for more than one block per multiprocessor) as far as I’ve understood.
Also, according to my cubin file I am using at most 40 bytes of shared memory per block (and 40 bytes < 16 kB). I am not allocating any shared memory in my kernel functions.
I have some really simple kernels, like
global void computeRho(float* d_result, float* d_R, float* d_Z, int width, int height)
int index = (blockIdx.x * blockDim.x + threadIdx.x)*width + (blockIdx.y * blockDim.y + threadIdx.y);
d_result[index] = d_R[index] * d_Z[index];
I’ve measured the time needed for the kernel call like this:
unsigned int timer = 0;
CUT_SAFE_CALL( cutCreateTimer( &timer));
CUT_SAFE_CALL( cutStartTimer( timer));
CUresult launchLfunc = cuLaunchGrid( computeL, height / block_size, width / block_size );
printf(“Launch L function: %d\n”, launchLfunc);
CUresult synch = cuCtxSynchronize();
printf(“Managed to synch %d\n”, synch);
CUT_SAFE_CALL( cutStopTimer( timer));
printf(“Processing time computeL: %f (ms)\n”, cutGetTimerValue( timer));
CUT_SAFE_CALL( cutDeleteTimer( timer));
and according to the results, it takes at most 1.4 msec to execute the most demanding kernel, which is way less than 5 seconds (the time allowed by the watchdog mechanism in Windows XP?). These figures apply to when the time out error does not occur (I just added the timer and haven’t got the error yet).
I would really appreciate any ideas on what might cause the time out error.
Thanks in advance,