CUDA 2.3 texture binding problem

Code that works using CUDA 2.2 fails after switching to 2.3.
Pitched linear memory is allocated and a 2D texture is bound. like so:
[indent]texture<int, 2, cudaReadModeElementType> dataTex;
CUDA_CHK(cudaMallocPitch ((void**)&d_data.ptr, &d_data.pitch, d_data.xsize, nRows));
CUDA_CHK(cudaBindTexture2D (NULL, dataTex, d_data.ptr, cudaCreateChannelDesc(), nCols, nRows, d_data.pitch));[/indent]
These calls return without error.
However then a kernel tries to fetch from the texture it fails:
[indent]datum = tex2D(dataTex, col + 0.5f, row + 0.5f);[/indent]
The returned error is cudaErrorUnknown in debug mode, but cudaErrorTextureNotBound in emulation mode.

It is hard to believe that this is a bug in 2.3, but I’m at a loss as to what I might be doing wrong because it worked under 2.2. Suggestions?

I am using Vista 64, VS 2008, compiling for x64, and using a 9800GTX+ card. When changing to CUDA 2.3 I also updated the driver to 190.38.

I have a very similar problem to yours!

My code in 2.2 SDK runs in release, but not in EmuDebug.
Now I got a new videocard (285GTX) and switched to SDK 2.3, and it stopped working even in release!

To complicate things even more, I have multiple .cu files in my project, which use the same texture variables… and some kernels are able to fetch from these textures, while others don’t…

I had same problem, when I update driver and SDK from 2.2 to 2.3 two days ago, and I fix it.

My solution was including cu files having kernels to the main cu file, or binding and fetching should be on a same cu file.

You can see a similar example in SDK examples, ‘simpleTexture.’ It uses two cu file and includes kernel cu file fetching texture memory from main cu file binding texture memory. So, what you have to do is reorganization to your code.

My original code binds texture memory on main cu file and fetches other cu files.

I placed global function declaration on header files, and included them, just as usual C programming.

It worked on SDK 2.2, but was crashed when the kernel functions try to access to the texture memory.

My GPU card is 9600GT, so I don’t know much about GTX, but it would work.

I had a similar problem as well when I tried to upgrade to 2.3. I got an unknown error in code that worked fine in CUDA 2.2. Unfortunately, I never found a solution and am still using 2.2.

Actually, I think the error was in the new drivers, since running 2.2 cuda code on the 190.38 driver gave me the same result. You might try using the CUDA 2.2 SDK with the new drivers on your code to see if that is the same for you.

2.2 used to allow binding a texture in one kernel and use it in another.
Looks like in 2.3, you now have to bind the texture to both kernels.