PC freezes on compiling CUDA problem

:wacko:
GUYZ help plzzz !!

global void adds(char *state, char *key)
{

int idx = blockIdx.x * blockDim.x + threadIdx.x;
if(idx < 1){
int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
state[i*4+j] ^= key[0 * Nb * 4 + i * Nb + j];
}
}
}
}

Am calling it like this:
adds<<< 1, 1 >>> (a_d, key);

The program takes, a 1d array, acts as if its a 2d array reading wise, and then XORes its contents with the key…

When I run EmuDebug I get perfect Results, but when I run it on Debug mood, it freezes my PC… I have a GTX 260 graphic card… Please guyz tell me what am I doing wrong !!! :wacko:

Maybe it’s accessing outside the memory described by ‘state’ and ‘key’. I see no boundary validation so maybe that’s the case.

What is the purpose of ‘Nb’ anyway? And why does it get multiplied by 0 when accessing ‘key’?

Thank you my friend for replying … External Media I fixed the problem. My mistake was sending the state to the cuda memory. But the key was still sent as an array from host, so cuda crashed when dealing with the key. All I did was put the key on the cuda memory and send it to the function and it worked. :rolleyes: Nb is supposedly the length of key in bits divided by 16. And I was multiplying by 0 just for testing. Now 0 is replaced by ‘round’ which is a variable inside a loop External Media Thank you for replying again :rolleyes: