page-locked memory


I have a very simple question. Is the so called page-locked memory allocated by cudaMallocHost() read only from the host side?

Is it possible that I lock the memory only when I do cudaMemcpy(), and I can modify it from host side at other time?

page-locked just means that the memory pages are locked and will not go and change physical addresses or be swapped out to disk by the OS. You can still write to them just like any other pointer.

Very clear! Thank you!

So it only makes sense when I use it together with cudaMemCpy(), right?

Are there some benchmarks showing the bandwidth differences using page-locked as opposed to regular malloc’d memory?

It can be a factor of two or more depending on your motherboard. You can test with the bandwidthTest program included in the SDK. Without any options, it uses regular malloc’d memory. With the “–memory=pinned” it runs with page-locked memory.