GPU Programming

What is a characteristic of CUDA shared memory?

  1. AA large main memory shared by all GPUs and the CPU
  2. BAn area where GPU memory is shared with the hard disk
  3. CA small, fast on-chip memory shared by threads of the same block and managed explicitly by the program
Show answer and explanation

Answer: C. A small, fast on-chip memory shared by threads of the same block and managed explicitly by the program

Shared memory is fast memory inside each SM, tens to a few hundred KB per block depending on the GPU, and can be read and written much faster than global memory (the GPU's DRAM). Threads in the same block can place and share data in it, so it is used to load data from global memory once and reuse it many times, or to pass intermediate results between threads. Unlike a cache, the program decides what goes there.

  • A. That is closer to global or unified memory.
  • B. It has nothing to do with disks.
  • C. Correct. It acts like a program-managed cache.