Hey guys,
I’m using a uchar4 texture reference; somehow it doesn’t work.
I defined cuda array and texture as the following code snippet; then strangely the kernels will refrain from doing any work ( like printf under emu mode, or some dummy d_odata[idx] = 255 output data assignment). Even if I don’t use any tex2D in the kernels, they still behave the same, doing nothing, while reporting no error.
If I simply quote out the cudaBindTextureToArray code, then the kernels behaves normal again (printf or dummy output data assignment)
Afterwards, if I turned the texture into a float4 one, then everything also became normal.
Has anyone ever tried out using uchar4 texture and succeeded? What could be the problem of this strange behavior? Any idea would be appreciated!
THX!
-
Dev Environment: Windows XP SP2 with MS Visual Studio 2005
-
CUDA version: 1.0
-
Hardware: AMD duo-core Opteron 2142, Geforce 8800GTS
// define texture reference
texture <uchar4, 2, cudaReadModeElementType > tex;
...
// allocate cuda array
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(8, 8, 8, 8,
cudaChannelFormatKindUnsigned);
cudaArray* cu_array;
cudaMallocArray( &cu_array, &channelDesc, width, height);
cudaMemcpyToArray( cu_array, 0, 0, h_data, width*height*4, cudaMemcpyHostToDevice); // uchar* h_data has been initialized properly
// bind array to the texture
cudaBindTextureToArray( tex, cu_array, channelDesc)
...