const __restrict を引数に付けるとTexture Cacheを自動的に使ってくれるらしい。
http://on-demand.gputechconf.com/gtc/2012/presentations/S0642-GTC2012-Inside-Kepler.pdf
これはMaxwellのGPUでも有効なんだろうか?Compute Capability指定いくつ以上から有効なんだろうか?
http://www.informit.com/articles/article.aspx?p=2103809&seqNum=5
のlast paragraphに、
On SM 3.5 and later hardware, reading global memory via the texture cache can be requested by using const __restrict pointers or by explicitly invoking the ldg() intrinsics in sm_35_intrinsics.h.
と書かれてあるから大丈夫かもしれない。実験しないと効果が納得出来ないけれど。
CUDA最適化の基礎
https://www.olcf.ornl.gov/wp-content/uploads/2013/02/GPU_Opt_Fund-CW1.pdf
GPUのハードウェアスレッド数はCPUに比べて100倍以上あったりするけど、自分のGPUを使うコードを書くスキルが低いからCPUのコードに比べて10倍以上の性能を叩きだすのが難しいなぁ。。
CUDA Occupancy Calculator
http://developer.download.nvidia.com/compute/cuda/CUDA_Occupancy_calculator.xls
Excel最強説…
Maxwell Tuning Guide
In a manner similar to Kepler GK110B, GM204 retains this behavior by default but also allows applications to opt-in to caching of global loads in its unified L1/Texture cache. The opt-in mechanism is the same as with GK110B: pass the -Xptxas -dlcm=ca flag to nvcc at compile time.
上のは試してみたけどあまり変わらなかった。。
Memory Coalescing
出来るだけ効率良くメモリアクセス出来るように処理を書く必要がある。
http://stackoverflow.com/questions/5041328/cuda-coalesced-memory