Prefetching with cudaMemPrefetchAsync
Moving pages before they are needed.
Stop Paying for Faults
Instead of waiting for slow first-touch faults, you can move pages early. cudaMemPrefetchAsync sends managed data to a device before the kernel needs it.
The Basic Call
You name the pointer, the byte count, and the destination device. This one prefetch migrates the whole range up front in a single efficient move.
cudaMemPrefetchAsync(data, n * sizeof(float), 0);All lessons in this course
- One Pointer, Both Sides
- On-Demand Page Migration
- Prefetching with cudaMemPrefetchAsync
- Hints via cudaMemAdvise