Friday, May 1, 2009

CUDA "unspecified launch failure"

The error "unspecified launch failure" usually means the same as "segment fault" for host code. Check that your code does not try to access any areas outside the arrays being used. A common mistake is using 'the whole idx' instead of just the thread id to access shared memory. Here's an example:

int idx = blockIdx.x * blockDim.x + threadIdx.x;
shared[idx] = input[idx];


will give you an error and should look like this:

int idx = blockIdx.x * blockDim.x + threadIdx.x;
int tid = threadIdx.x;
shared[tid] = input[idx];

3 comments:

  1. i am having the same error and using tid is not helping as well ... what else can be the problem??

    ReplyDelete
  2. Thanks a lot! When I had this problem, it was "segmentation fault" too.

    ReplyDelete
  3. Thanks a lot your post saved me a lot of time sir.

    ReplyDelete