I have following code in my host function:
int P,Q;
P = SIZE; Q = SIZE;
Real* A;
A = (Real*)malloc(sizeof(Real)PQ);
memset( A, 0, sizeof(Real)PQ );
cuda_kernel<<<Dg,Db>>>(A);
free(A);
the kernel just simply set some value to A. I ran the code and saw the value been set to A successfully
then I comment the “cuda_kernel<<<Dg,Db>>>(A);” line from the code and execute the program again. I expect to see 0 as initial value of A but strangely I found A still holds the value that “cuda_kernel” gave it.
I think the memset function didn’t work in this case. But I really dont know why.
Could anybody give me an clue of this.
Thanks