Can anyone tell me why this kernel code crashes

Can anyone tell me why this kernel code crashes every time please:

int same =1;

for (i =0; i<32; i++){

if (toFind[i] != getting[i]) same = 0;

}

if (same == 1) {ptgot[0] = key[0]; ptgot[1] = key[1]; ptgot[2] = key[2]; ptgot[3] = key[3]; ptgot[4] = key[4]; ptgot[5] = key[5];}

same = 1;

If i remove:

if (toFind[i] != getting[i]) same = 0;

it runs ok.

Thanks in advance.

Directly with this snippet, no. But I’m sure using cuda-memcheck will prove insightful for you.

Heres the entire code attached. Line 184 is where problem is.

I’ll have a look at cuda-memcheck.

Thanks for your quick response.
counter.cu (8.72 KB)

Well, the two only things I see are:

    The out of bound access to getting line 182

    The format error in printf line 243

The first error having undefined behaviour, it might be the cause of your problem. But beside this, nothing obvious that I can spot immediately.

Ok, i’ll check that out.

Thanks for your help.