May 2019
Intermediate to advanced
452 pages
12h 16m
English
This feature allows data pointers to allocate memory on the GPU device that can be accessed by both the CPU and the GPU. With this shared memory access, the need for CPU allocation for host variables is eliminated. The following declaration example differentiates UMA from conventional memory allocation:
|
Conventional CPU memory allocation |
Unified memory allocation |
char *data;data = (char *)malloc(N) |
char *datacudaMallocManaged(&data, N) |
By using cudaMallocManaged, we can allocate memory on the GPU that can be migrated between both the CPU and the GPU. So, with unified memory access, we can pass that data pointer to a CPU function, as well as a GPU kernel!
Read now
Unlock full access