Hello,
I use data in read only access mode and I guessed I could use texture memory to do that.
My idea is to use texture like an array, but with cache.
But it doesn’t work at this time.
Texture is declared like that :
texture<float, 1, cudaReadModeElementType> tex;
Data array is allocated and filled like that :
cudaMalloc( (void**) &d_population, sizeof(float)*dimX*dimY);
cudaMemcpy( d_population, pop , dimX*dimY*sizeof(float*),cudaMemcpyHostToDevice);
(pop and d_population are 1D array)
I bind the texture this way :
cudaBindTexture(0,tex,d_population,sizeof(float)*dimX*dimY);
Finally in the kernel, I use the texture like that :
float value = tex1Dfetch(tex,0);
But the value is not what I expect, I get some random value and as I’m beginner in cuda, I guess there is a problem in my methodology.
I try with cudaArray, but without more result.
I run my tests in device-emulation but I guess that texture is emulated too.
Did I do something wrong ? Any idea ?
Many thanks
With regards
Ojjy