When to use pin memory?


I would like to know exactly what are the situations where we can use page locked or pin memory and really enhance the performance of our CUDA program.


Wishing you a very happy new year!!

in general when copying large data blocks multiple times to the gpu. You have to use it for streams.

Thanks for your reply erdoom!!

Well, in almost every CUDA-based applications, one has to copy data from from main memory to DRAM of the GPU, process the data in parallel on the GPU, copy it back to the main memory, then copy new data from the main memory to the DRAM of the GPU and so on…

So would you please elaborate it further?

And also are you talking about “streams” as a continuous flow of data e.g in video streaming ?

Streams as in that described in Section of the CUDA programming guide, which you have, no doubt, read:

streams let you do concurrent kernel execution and mem copy operations. for small mem copies the performance boost using pinned memory is almost in significant, but if you repeatedly copy a big chunk back and forth then it can really help, just remember that on the other hand allocating allot of pinned memory can start effecting the performance of your os.