gamerx
gamerx

Reputation: 579

CUDA Global Memory, Where is it?

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?

Upvotes: 0

Views: 2695

Answers (3)

Pedro
Pedro

Reputation: 1384

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.

Upvotes: 1

Greg Smith
Greg Smith

Reputation: 11509

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.

Upvotes: 5

Roger Dahl
Roger Dahl

Reputation: 15724

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.

Upvotes: 3

Related Questions