Textures bug


Using several CUDA textures in multiple CUDA source files doesn’t work.

Cuda 2.1
Driver 180.44
Ubuntu 8.10 64bits

I reproduce the bug and propose a hack (the zip).

Bug_Textures.zip (5.59 KB)

Up ! Am i alone with this problem ?

I didn’t actually look at your code, but are you trying to declare a texture in a header file and then use it in multiple compilation units?

You cannot do that. The programming guide documents that texture references are implicitly declared static and thus only exist within a single compilation unit. It is unfortunate that the compiler does not generate an error when one tries to declare an extern reference.

Surprisingly, it runs when i use a header, the kernels use the right textures. Otherwise the two kernels use the first declared texture and ignore the second.