I have been reading about the various approaches to memory management offered by CUDA, and I'm struggling to understand the difference between mapped memory:
int *foo;
std::size_t size = 32;
cudaHostAlloc(&foo, size, cudaHostAllocMapped);
Run Code Online (Sandbox Code Playgroud)
...and managed memory:
int *foo;
std::size_t size = 32;
cudaMallocManaged(&foo, size);
Run Code Online (Sandbox Code Playgroud)
They both appear to implicitly transfer memory between the host and device. cudaMallocManaged seems to be the newer API, and it uses the so-called "Unified Memory" system. That said, cudaHostAlloc seems to share many of these …