What is Unified memory?
Memory accessible from CPU and GPU through the same pointer, with data migrating automatically on access. It simplifies programs, but migration costs need attention.
Japanese name: ユニファイドメモリ
Memory accessible from CPU and GPU through the same pointer, with data migrating automatically on access. It simplifies programs, but migration costs need attention.
Japanese name: ユニファイドメモリ
In CUDA, memory allocated with cudaMallocManaged is unified memory. Data is managed in pages, and on GPUs and systems that support page faulting, when the GPU touches a page that resides on the CPU side, the driver migrates it to GPU memory; when the CPU touches it, it moves back. No explicit cudaMemcpy is needed, so complex data structures containing pointers can be used as they are. On such systems you can also allocate more data than fits in GPU memory and process it while only the parts needed are moved in.
Handling page faults and transferring data in small pieces tends to be slower than a single bulk copy, and if the CPU and GPU take turns using the same pages, the pages bounce back and forth and performance drops sharply. When speed matters, cudaMemPrefetchAsync moves data before it is used, and cudaMemAdvise tells the driver things such as that the data is mostly read. A common approach is to get the program working with unified memory first, inspect the migrations with a profiler, and then add such hints.
Unified virtual addressing (UVA) only places CPU and GPU memory in one address space; it does not move data automatically. Zero-copy access lets the GPU read pinned host memory directly over PCI Express without moving it. A SoC design in which the CPU and GPU physically share the same DRAM is also called "unified memory". CUDA unified memory differs in being a programming mechanism that also works on GPUs with their own separate memory.
Answer: A. Memory usable from both CPU and GPU through the same pointer, with data migrating automatically as needed
With unified memory, an allocation can be accessed from both CPU and GPU through the same pointer. On GPUs and systems that support page faulting, data migrates page by page to whichever side accesses it. Programs become simpler, and on such systems data larger than GPU memory is also easier to handle. Each migration involves page faults and transfers, though, so for performance, programs issue hints to prefetch data in advance.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.