I am trying to copy an array from the host into 2D device memory. The currently the data is copied but the padding is wrong. I tried reading the reference manual and I think I passed the correct parameters. They’re both square matrices(dimension x == dimension y) Here is what I have.
cudaMemcpy2D(d_mat2,pitch2,mat2,memWidth,memWidth,dim ,cudaMemcpyHostToDevice); checkCUDAError("Memcpy 2D");
d_mat2 is the matrix on the device here is the declaration
pitch2 is the pitch I got when using cudaMalloc2D
mat2 is the matrix to be copied (allocated as a dynamic one dimensional array type double)
memWidth is the size of double times dim (the dimension)
dim is the dimension