The documentation对于cudaHostAlloc()
说,使用cudaHostAllocMapped
标志,它会在主机上分配固定内存,并将分配映射到CUDA地址空间中。这是否意味着设备上也分配了镜像缓冲区?在cudaHostAlloc()
或cudaHostGetDevicePointer()
呼叫期间。 或者每次访问由cudaHostGetDevicePointer()
返回的指针时,设备是否与主机存储器通信?cudaHostAllocMapped是否也在设备上分配缓冲区?
这个问题与When to use cudaHostRegister() and cudaHostAlloc()? What is the meaning of "Pinned or page-locked" memory? Which are the equivalent in OpenCL?不同,因为我不问API是什么,什么时候使用它们,什么是固定内存。我具体问是否在GPU上分配了镜像缓冲区。
的可能的复制[何时使用cudaHostRegister()和cudaHostAlloc()? “固定或页面锁定”内存的含义是什么?这是在OpenCL的等价?(http://stackoverflow.com/questions/39454465/when-to-use-cudahostregister-and-cudahostalloc-what-is-the-meaning-of-pinn) – Leos313
@ Leos313,有在这个问题中没有什么或者关于镜像缓冲区的答案。我已经知道这个问题的答案。我对GPU如何访问CPU内存的细节感兴趣。 –
没有分配内存的设备上,所有访问到主机内存。 [本文档(http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#mapped-memory)可能更适合您的需求。 – tera