cudaBindTexture fails for large memory


I have NVIDIA GPU Computing Toolkit\CUDA\v8.0 installed on my computer.
When I am trying to bind texture for memory larger than 12810241024*4, I get “invalid argument” error.


cudaMalloc ((void**) &state->dev_vol, vol->npix * sizeof (float));
CUDA_check_error (“Failed to allocate dev_vol.”);
cudaMemcpy (state->dev_vol, vol->img, vol->npix * sizeof (float), cudaMemcpyHostToDevice);
CUDA_check_error (“Failed to memcpy dev_vol host to device.”);
cudaBindTexture (0, tex_vol, state->dev_vol, vol->npix * sizeof (float));
CUDA_check_error (“Failed to bind state->dev_vol to texture.”);

Any workaround/fix for this issue?


Have you checked whether your code may be exceeding the maximum supported texture dimensions? There is a handy table at the end of the CUDA Programming Guide spelling out relevant limits. These limits are driven by hardware limitations and as such will not change for existing GPUs. They have also been quite stable over time.

What I have done in the past is map overly large objects to two textures. This obviously complicates the code a bit. You might want to check whether you actually need a texture, especially if the texture usage was originally introduced for performance reasons.