cuda-gdb get different result with cudaMemcpyHostToDevice function

I am using ubuntu 9.10 64bit, with gcc/g++ 4.3, nvcc 3.0, Telsa C1060.

I have a simple code like this:

int idate[3];

double param_d[2];

idate[0]=2002;idate[1]=1;idate[2]=3600;

param_d[0]=3600.0;param_d[1]=1.0;

int* cuidate;

cudaMalloc((void**)cuidate,3*sizeof(int));

cudaMemcpy(cuidate,idate,size,cudaMemcpyHostToDevice);

double* cuparam;

cudaMalloc((void**)&cuparam_d,2*sizeof(double));

cudaMemcpy(cuparam_d,param_d,2*sizeof(double),cudaMemcpyHostToDevice);

then debug in cuda-gdb, I got this result:

(cuda-gdb) p *param_d@2

$6 = {3600, 1}

(cuda-gdb) p *cuparam_d@2

$7 = {0.11886506690014327, 0.21219339590896316}

(cuda-gdb) p *idate@3

$8 = {2002, 1, 3600}

(cuda-gdb) p *cuidate@3

$9 = {-419883931, 1069444592, 938317621}

So, where is the problem?

Thanks.

There is an error in the cudaMalloc call which allocates cuidate. If you add some error checking, you might find that the cudaMemcpy for cuidate is failing with an invalid device pointer.

Thank you, I will try it.