How can I use cudaMemcpyFromSymbol ?

Hi,
I try to use cudaMemcpyFromSymbol and cudaMemcpyFromSymbol, but I didn’t get what I want.

Here is what I did

device int totalactive;

global void foo() {
totalactive = 1;
}

and in some functions, I call foo and

int t=123;
cudaMemcpyFromSymbol((void*)&t, totalactive,1));
printf(“%d\n”,t);

I got 123 as the result, not 1.

I don’t really need it, but I’m still curious how.

thanks,

Yam

Try replacing the ,1 ) in the memcpy with ,sizeof(int) )