newbie error on dvice to device copy

Hi,

i’m trying to make a device to device copy using cudaMemcpy3D but i get an error. What i’m trying to do is this:

cudaMalloc((void **)&f1_data, ni*nj*nk); 
cudaChannelFormatDesc desc;
cudaExtent extent;
desc = cudaCreateChannelDesc<float>();
extent.width  = ni;
extent.height = nj;
extent.depth  = nk;
cudaMalloc3DArray( &f1_array, &desc, extent);

cudaMemcpy3DParms p1 = { 0 };
p1.extent = extent;
p1.kind = cudaMemcpyDeviceToDevice;
p1.srcPtr = make_cudaPitchedPtr( (void*)f1_data, ni*sizeof(float), ni, nj );
p1.dstArray = f1_array;
cudaMemcpy3D(&p1);

printf(“CUDA: %s\n”, cudaGetErrorString(cudaGetLastError()));

the f1_data array has been modified by a kernel and i want to copy it to the array in order to modify it for a second time.
on the comand line i get the following string:

CUDA: invalid argument

however i think i am using everything as the reference manual says. Please help me out. i dont know what i am doing wrong.
i would really apreciate any help.
cheers.
C.