On 07 Nov 2009, at 20:12, Andrew Byrd wrote:

>> Is the binding of a GPUArray to a Texture not supported, Or did I miss something ??

I was having the same problem, trying to pass GPUArrays' gpudata into my kernels to do other processing. I think I've figured out what's going on.


After some further experimentation, I've found out more details.

You can indeed bind GPUArrays to textures, and read them with tex2D. The current bind_to_texref_ext() does a 1D binding, but there is a 2D function available. Borrowing from that original code, I was able to make a GPUArray.bind_to_texref_ext_2D() using an ArrayDescriptor and TextureReference.set_address_2d() .

There are some problems in practical use. First, you have to reverse the order of the indices when you call tex2D. I think this is because GPUArrays use C ordering and CUDA uses Fortran ordering. Second, there are alignment restrictions on texture memory (256 bytes usually) so your rows need to be a multiple of 256 bytes long. You could pad the rows, but GPUArrays are set up to be contiguous. Third, it looks like you still don't get hardware interpolation/filtering.

My conclusion is that in general it's better to just copy the data to a CUDA Array ( as is done in matrix_to_texref() ) or address it as a 1D array using tex1Dfetch() in device code, calculating your own 'flat' addresses.

Thanks,
Andrew

_______________________________________________
PyCUDA mailing list
[email protected]
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to