CUDA Global Memory, Where is it?

橙三吉。 提交于 2019-12-13 00:58:57

问题


I understand that in CUDA's memory hierachy, we have things like shared memory, texture memory, constant memory, registers and of course the global memory which we allocate using cudaMalloc().

I've been searching through whatever documentations I can find but I have yet to come across any that explicitly explains what is the global memory.

I believe that the global memory allocated is on the GDDR of graphics card itself and not the RAM that is shared with the CPU since one of the documentations did state that the pointer cannot be dereferenced by the host side. Am I right?


回答1:


Global memory is a virtual address space that can be mapped to device memory (memory on the graphics card) or page-locked (pinned) host memory. The latter requires CC > 1.0.

Local, constant, texture, and local memory are allocated in global memory but accessed through different address spaces and caches.

On CC > 2.0 the generic address space allows mapping of shared memory into the global address space; however, shared memory always resides in per SM on-chip memory.




回答2:


Global memory is off-chip but on the graphics card.

Local memory is stored in global memory but addresses are interleaved in such a way that when arrays are store there, accesses are coalesced when each thread in the warp reads from the same index in its array.

Constant and texture memory is also (initially) stored in global memory, but it is cached in on-chip caches.

Shared memory and the L1 and L2 caches are on-chip.




回答3:


This is discussed in Section 3.2.2 of the CUDA C Programming Guide. In short, all types of memory, i.e. shared, constant, texture and global, reside in the memory of the device, i.e. the GPU, itself.

You can, however, specifically declare parts of memory to be "Mapped", i.e. memory on the host to be accessible from the device. For this, see Section 3.2.4 of the Programming Guide.



来源:https://stackoverflow.com/questions/11178506/cuda-global-memory-where-is-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!