invalid texture reference on cudaBindTextureToArray

Hi,

I have a weird behavior with my CUDA program.

Running my program in debug mode is all fine.

Running my program in release mode crashes with a invalid texture reference error.

The problem occures at cudaBindTextureToArray:

bool BindTextureToArray(void*image, unsigned int width, unsigned int height, int imageNumber)

{

	cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<uchar4>();

	

	cudaMallocArray  ( &ImageArray[imageNumber], &channelDesc, width, height ); 

	cudaMemcpyToArray( ImageArray[imageNumber], 0, 0, image, sizeof(unsigned char)* width * height * 4, cudaMemcpyHostToDevice)); 

	cudaBindTextureToArray(image0, ImageArray[imageNumber], channelDesc);

	if(checkCUDAError("BindTextureToArray: cudaBindTextureToArray\n") == false)

		return false;

	return true;

}
cudaArray* ImageArray[NumberOfImages];

void* image points to a unsigned char pointer on the data

I can not image why this happens only in release mode.

Could it be because I split my code in several files?

texture global declare in: gpu_global.h

texture defined in: gpu_init.cu

BindTextureToArray in: gpu.cu

But i tried to push all my code in one file, but nothing changed.

Should i change to another Cuda Version? 2.0 or 2.2?

Or another driver version?

I would appreciate any advice, hints, thoughts…

thanks!

Hendrik

My computer configuration:

Quadro FX 3600M (notebook graphic card)

DirectX Version: 10

Driver Version: 185.85

compute capability: 1.1

Cuda compilation tools, release 2.1, V0.2.1221