making 3D array from several 2D arrays and vice versa

Hi,

In my process I need to manipulate some 2D cuda arrays at the beginning (the number depends of one parameters). But then, I need to use all these arrays in an other kernel.

2 Solutions:

1/- Making 3D arrays from the 2D ones (and after the kernel, doing the inverse)

2/- working with a pointer of some textures, so doing a malloc on a texture* in a cuda file… >.<

I have NO idea how doing the 1/ and I am trying the 2/ without any success for the moment :/
Feel free to help me :D

Thx

:wacko:

I tried all the solutions I thought, without success

Even that doesn’t work:

texture<float, 2, cudaReadModeElementType> texRefFoo[3]; 

__global__ void

kernel()

{

 Â  Â  Â //[...]

 Â  Â  Â texFoo = tex2D( texRefFoo[0], x, y);

}

error: identifier “texRefFoo” is undefined

<img src=‘http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/crying.gif’ class=‘bbc_emoticon’ alt=’:’(’ />

You cannot have an array of texture references.

Thx for your answer.

So,

I have to store my 2D arrays in a linear memory buffer, and copy this buffer in 3D array after that. A little bit “complicated” just for getting a 3d array from several 2d ones. I thought it should be a simple pointer arithmetic process… :/