cudaMallocPitch! simple example cudaMallocPitch

Hi,

I am new to cudaMallocPitch . I have a two-D datset in sizes LX and LY.

[codebox]

#define LX 3

#define LY 3

global_ void multi( double *M1, size_t p_M1)

{

int j, k;

for(j = 0; j <LX; j++)

{

float* row = (float*)((char*)M1 + j * p_M1);

for(k=0;k<LY;k++)

{

M1[k] = row[k];

}

}

}[/codebox]

how can I write a matrix as below

LX=3, LY=3.

1 2 3

4 5 6

7 8 9

I will appreciate any help with code snippets. I have posted my code above, but it assigns only initial value.

Thanks