Texture Memory <-> normal Array -> Values differ completly

Im doing an image registration on the gpu and implented it via global memory.

Now wanted to test if i can benefit from the texture memory and looked up an official example and used its code.

I didn’t expect to get the same values but not a difference of 76 between 2 elements.

What i dont understand, normaly there shouldn’t be any interpolation in case im fetching the voxel exactly (what I am doing)?

Anybody got an idea what could be the problem.

Below you find the code and the output of my comparison.

I would be really really thankful if somebody could help me.

[codebox]void copyImagetoDevice(const uchar *h_volumeA, cudaExtent volumeSizeA) {

// Copy Images to Device

// create 3D array

cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<uchar> ();

cutilSafeCall( cudaMalloc3DArray(&d_volumeA, &channelDesc, volumeSizeA) );

// copy data to 3D array

cudaMemcpy3DParms copyParams = { 0 };

copyParams.srcPtr = make_cudaPitchedPtr((void*) h_volumeA, volumeSizeA.width * sizeof(uchar), volumeSizeA.width, volumeSizeA.height);

copyParams.dstArray = d_volumeA;

copyParams.extent = volumeSizeA;

copyParams.kind = cudaMemcpyHostToDevice;

cutilSafeCall( cudaMemcpy3D(&copyParams) );

// set texture parameters

texA.normalized = false; // access with normalized texture coordinates

texA.filterMode = cudaFilterModeLinear; // linear interpolation

texA.addressMode[0] = cudaAddressModeClamp; // wrap texture coordinates

texA.addressMode[1] = cudaAddressModeClamp;

texA.addressMode[2] = cudaAddressModeClamp;

// bind array to 3D texture

cutilSafeCall(cudaBindTextureToArray(texA, d_volumeA, channelDesc));

}[/codebox]

Then i wrote an method too compare the values of my array with the ones of the texture memory:

0 -> no difference (with little tolerance)

1 -> difference between two elements was 1

difference[0]: 6102472

difference[1]: 493923

difference[2]: 231352

difference[3]: 145625

difference[4]: 109717

difference[5]: 90542

difference[74]: 3

difference[75]: 0

difference[76]: 2

I am having this issue also. In device emulation mode, I can get the correct values that I want but in release mode, the outputs are off. I am also trying to access each texels at its exact address.

Here is how my texture reference is set up (very similar to the SDK example).

reftex.addressMode[0] = cudaAddressModeClamp;

   reftex.addressMode[1] = cudaAddressModeClamp;

   reftex.filterMode = cudaFilterModePoint;

   reftex.normalized = false;

Should I be managing it differently?

The strange thing is, that I already get these wrong results in emulation mode.

Did nobody have an similar issue he solved?

cudaFilterModePoint is working for me in emulation mode and device mode.

Where can i find a short explanation what the 2 filter modes do exactly, because i intended to use the linear interpolation and thats not working for me.