One Pointer, Both Sides
How cudaMallocManaged works.
The Two-Pointer Headache
So far you juggled two pointers: one for the host, one for the device. Unified Memory replaces that pain with a single pointer both sides can use. 🙂
Meet cudaMallocManaged
You allocate managed memory with cudaMallocManaged. It hands back one address that works in your CPU code and inside your kernels alike.
float *data;
cudaMallocManaged(&data, n * sizeof(float));All lessons in this course
- One Pointer, Both Sides
- On-Demand Page Migration
- Prefetching with cudaMemPrefetchAsync
- Hints via cudaMemAdvise