cudaMallocManaged allocates memory on both host & device, and keeps them synced.
- In the docs for cudaMemAdvise:
cudaMemAdviseSetReadMostly: This implies that the data is mostly going to be read from and only occasionally written to. Any read accesses from any processor to this region will create a read-only copy of at least the accessed pages in that processor’s memory.
If I’m reading this right, this means calling cudaMemAdvise with cudaMemAdviseSetReadMostly), then read-accessing the memory on the device, results in two copies of the data on the device. Is this correct?
- Again from the docs:
Additionally, if cudaMemPrefetchAsync is called on this region, it will create a read-only copy of the data on the destination processor.
Is the same copy as caused by the read-access? Or is it an additional (third) copy)?
(I’m assuming the former, but the docs aren’t 100% clear.)