when I malloc a cuda array with width and length on the device ,then bind a texture to the array,while i read the array using tex2D( ref,a,b ), (a,b is coordinate of the cuda array ,I convert them from int to float),but what I read from the array is always 0, or some strang num,not the num in the array.
(the filter mode and normalized mode are the default,in fact it is not need)
can someone tell me why
i try to set the normolized on and off, and also the clamp or wrap mode,but the result is not changed at all, or changed to very strange data. i don’t know what is the reason.
is there someone meeted the same question with me ,or may i is wrong using the texture function,but what i do is under the sample of nv, or because my compute ability is 1.0…
Make sure that the host pointer u is of type void*, here:
cudaMemcpyToArray(d_u,0,0,u, 20502050sizeof(float),cudaMemcpyHostToDevice);
I would suggest working on a small 2D array that can be dumped to the disk and examined. Then you can see at what stage the problem arises. There could be a problem, say, while copying host mem to device, texture access, or while you reading the value r.