What is pitch?

I am trying to copy a 2D array to the GPU using cudaMallocPitch(). I can get the destination pitch from this function, but how to I know the source pitch of my array.

For example:

float **numbers;  //10x20 array

float **d_numbers;

size_t d_pitch;

cudaMallocPitch( (void)** &d_numbers, &d_pitch, 10*sizeof(float), 20)

cudaMemcpy2D(d_numbers, d_pitch, numbers, ????, 10, 20, cudaMemcpyHostToDevice);

You should know the pitch from the way you allocated numbers.

i.e.

float *numbers.

numbers = (float*)malloc(sizeof(float) * pitch * height);

And your float **d_numbers must be a typo, for this to work you want float *d_numbers.