cudaMalloc3DArray with different width, height and depth

I’m trying to create a volume and then bind it to a texture, it works fine if the x- y- and z-sizes are the same, but if they differ it does not work as I want.

In all the code that uses make_cudaPitchedPtr that I’ve seen, the depth is missing, i.e.

make_cudaPitchedPtr((void*)h_Volume, sizeof(float)*DATA_W , DATA_W, DATA_H);

where should i put DATA_D ??

Here is the code that I use

According to the programming guide I should use

but how do I bind this allocated data to a texture?? I haven’t found any cudaBindTexture3D (and the 2D version is not found when I try to use it). Can I still use cudaBindTextureToArray somehow?

hey wanderine,

where u able to solve this… i am also trying to achieve same but i am getting ‘invalid texture reference’ error from cudaBindTextureToArray() method.

I dont know if my volume is properly loaded in cuda Array or not… how do we verify this and if its there then how can we loop though its element without using texture??

any clues??

No I have not solved this yet, maybe Nvidia can make a convolution SDK example for 3D for non separable filters?

Seems a bit confusing but it actually works when I changed one line to this

copyParams.srcPtr = make_cudaPitchedPtr((void*)h_Volume, sizeof(float)*DATA_W , DATA_W, DATA_H);

Why is there not a good explanation of make_cudaPitchedPtr in the reference manual?

Maybe it’s clear to you now how the pitching business works but if it’s not here is a brief explanation.

[url=“Michael Pfeuti » CUDA 3D Array Pitch”]http://www.ganymede.ch/2009/08/17/cuda-3d-array-pitch/[/url]