# cuda sample using \_\_ldg()..?

**URL:** <https://forums.developer.nvidia.com/t/cuda-sample-using-ldg/33033>\
**Category:** CUDA Programming and Performance\
**Created:** [April 24, 2014, 12:45pm UTC](https://forums.developer.nvidia.com/t/cuda-sample-using-ldg/33033 "2014-04-24T12:45:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![little\_jimmy](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@little\_jimmy](https://forums.developer.nvidia.com/u/little_jimmy)\
**Post date:** [April 24, 2014, 12:45pm UTC](https://forums.developer.nvidia.com/t/cuda-sample-using-ldg/33033/1 "2014-04-24T12:45:09Z")

</div>

Hello,

Does one of the cuda samples use \_\_ldg() somewhere in the code…?

---

<div class="post-metadata">

**Author:** ![vacaloca](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@vacaloca](https://forums.developer.nvidia.com/u/vacaloca)\
**Post date:** [April 24, 2014, 1:49pm UTC](https://forums.developer.nvidia.com/t/cuda-sample-using-ldg/33033/2 "2014-04-24T13:49:54Z")

</div>

I did a quick find on Windows and it doesn’t seem like any of the CUDA 5.5 or 6.0 samples use it.

Here’s some past threads that lalk about that instruction, in case they happen to answer your question:  
[url][Why L1 cache hit ratio become zero on K20? - CUDA Programming and Performance - NVIDIA Developer Forums](https://devtalk.nvidia.com/default/topic/527670/why-l1-cache-hit-ratio-become-zero-on-k20-/%5B/url%5D)  
[url][const \_\_restrict\_\_ read faster than \_\_constant\_\_ ? - CUDA Programming and Performance - NVIDIA Developer Forums](https://devtalk.nvidia.com/default/topic/673271/const- __restrict__ -read-faster-than- __constant__ -/%5B/url%5D)  
[url][ldg versus textures - CUDA Programming and Performance - NVIDIA Developer Forums](https://devtalk.nvidia.com/default/topic/638031/ldg-versus-textures/%5B/url%5D)

Here’s a slideshow with a small example:  
[url][http://on-demand.gputechconf.com/gtc/2013/presentations/S3011-CUDA-Optimization-With-Nsight-VSE.pdf[/url]](http://on-demand.gputechconf.com/gtc/2013/presentations/S3011-CUDA-Optimization-With-Nsight-VSE.pdf%5B/url%5D)  
Pretty much the same as above, maybe on different hardware? looked the same at first glance:  
[url][http://calcul.math.cnrs.fr/IMG/pdf/CUDA-Optimization-Julien-Demouth.pdf[/url]](http://calcul.math.cnrs.fr/IMG/pdf/CUDA-Optimization-Julien-Demouth.pdf%5B/url%5D)

library that templates ldg instruction for other non-native types:  
[url][https://github.com/BryanCatanzaro/generics[/url]](https://github.com/BryanCatanzaro/generics%5B/url%5D)
