I am reading the NVIDIA white paper titled Particle Simulation with CUDA by Simon Green.
It describes the SDK particles example and the algorithms used.
While discussing performance of the code, the author says that global memory arrays of position and velocity of the particles are "bound" to textures.
Now I am very confused by the concept of texture memory. The NVIDIA CUDA programming guide goes through some really gory and difficult explanations without any examples.
Hence I have 2 questions:
Can someone give / refer me to a really simple (Texture memory for dummies) example of how texture is used and improves performance.
The CUDA programming guide 4.0 on page 40 on page says "A texture can be any region of linear memory or a CUDA array". Now if, ( as is said ), texture memory gives better performance than global memory why not "bind" the entire global memory to texture memory?
simpleTexture
which demonstrates performing a trivial 2D coordinate transformation using a texture.So something like particle simulation can benefit from textures because calculations are generally performed in cells or control volumes where local interactions are considered, and neighbour particles need to access each others velocities and accelerations. A spatially local cache works better for this than a simple linear memory cache. But for other applications, there isn't intrinsic spatial locality in memory access patterns, and textures provide little or no benefit over conventional cached memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With