Question about cudaMemcpy2D

Hi all,

I am confused of how to use the cudaMemcpy2D.

The following is the 2D array I need, how could I copy it to GPU?

  int **hTest = (int**)malloc(row*sizeof(int*));

   for(int i=0;i<row;i++){

     *(hTest +i) = (int*)malloc(col*sizeof(int));

   }

  for(i=0;i<row;i++) {

       hTest [i][0]=0; 

   }

  //Is the following the way to use?

   int *dTest;

   size_t dPitch;

        CUDA_SAFE_CALL(cudaMallocPitch((void**)&dTest,&dPitch,sizeof(int)*col,row));

        CUDA_SAFE_CALL(cudaMemcpy2D(dTest,dPitch,hTest ,sizeof(int)*col,sizeof(int)*col,row,cudaMemcpyHostToDevice));

  myKernel<<<g,b>>>(dTest,dPitch/sizeof(int));

  __global__ myKernel(int *dTest, int dPitch){

     ...

   }

Thx all!!