So I have not been able to get my 2d array to copy into GPU space. I have tried with mallocpitch and memcpy2Dtoarray, with no success. I have simplified to malloc and memcpy to try and get results. The memory management functions execute and return cudaSuccess, but the array on the GPU is all 0’s. I assume i have a syntax issue somewhere. Relevant code:
double u[L+3][steps+1];
double *u_dev;
cudaMalloc((void**)&u_dev, (L+3)*(steps+1)*sizeof(double));
cudaMemcpy(u_dev, u, (L+3)*(steps+1)*sizeof(double), cudaMemcpyHostToDevice);
I cut out the initialization of u, but it is just a triangular wave. I expect to see a linear array with the values from u placed in u_dev after the memcpy. Instead I get from cuda-gdb:
(cuda-gdb) p u_dev
$5 = (double *) 0x200100000
Ideas? Thanks.