simpleTexture cudaBindTexture() API not in docs?

I was unable to locate a description of the cudaBindTexture() variant used in the simpleTexture example project. Section (page 32) contains descriptions of two other versions which accept different parameters, but not the version used in the sample code. Just FYI…


Thanks for pointing this out.

The simpleTexture example is using a variant of cudaBindTexture() that’s defined in “cuda_runtime.h” rather than “cuda_runtime_api.h” which is the C API.

This will be fixed in the next release. In the meantime here’s the necessary changes:

   // allocate array and copy image data

    cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 0, 0, 0, cudaChannelFormatKindFloat);

    cudaArray* cu_array;

    CUDA_SAFE_CALL( cudaMallocArray( &cu_array, &channelDesc, width, height )); 


   // Bind the array to the texture

    cudaBindTexture( tex, cu_array, channelDesc);