So it looks like make_cudaPitchedPtr() either assigns 0s or ignores width and height of cudaPitchedPtr structure parameters to make_cudaPitchedPtr()
Am I missing something here, doing wrong?
Also, related to this,
when I try to make cudaMemcpy3DParms copyParams.dstPtr structure xsize and ysize fields to be the same as srcPtr - I am getting an error when I do cudaMemcpy3D() - “invalid device pointer”.
It’s ok to make the pitch the same between srcPtr and dstPtr, but make xsize and ysize the same is not.
It looks like you’re outputting the wrong values (i.e., the ones from dstPtr instead of srcPtr)? Also the second fprintf() has two %d’s but only one value passed in.
PS: The make_cuda*() functions are actually inline functions defined in driver_functions.h, so you can take a look at the implementation if you want. (It’s very straightforward.)
But are you going to fix the CUDA Programming Guide, which still has a bug in the last listing on page 20? I believe that the extent should be declared as
What’s even more confusing is that when an extent is passed to [font=“Courier New”]cudaMalloc3DArray[/font] (as opposed to a plain [font=“Courier New”]cudaMalloc3D[/font]), the width field of the extent is supposed to be in elements, and not bytes.