Problem to use the pitch, returned by cudaMallocPitch, with cudaMemcpy3D!

Hi all!

I have a problem! I try to copy a device buffer into a cudaArray and bind it to a texture 3D. Then, I copy the content of this texture to another device buffer trough a kernel!

In attachment you can find an example of my code which does not work! I try to run it with cuda 2.1 and cuda 2.0, without any difference.

The copy works only in device emulation when I replace the srcPitch variable (testTexture3D.cu: line 134) by the pitch value: srcDimx*sizeof(float)!
But, I can do that in release mode because I got a cuda error:
Cuda error in file ‘testTexture3D.cu’ in line 136 : invalid argument.

I have to put the pitch value returned by the cudaMallocPitch function, to solve this error, but I got an alignment of my cudaArray, which shift his values!

Could anyone help me?

Thank you
exampleTexture3D_cuda2.1.zip (3.5 KB)