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, typically tens of KB per block, and can be read and written many times 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.
Practice this topic Back to topic

More GPU Programming questions

  1. What does CUDA's __syncthreads() do?
  2. In CUDA, __syncthreads() is placed inside "if (threadIdx.x < 16)" so that only some threads reach it. What can happen?
  3. Which describes a bank conflict in CUDA shared memory?
  4. A 32 × 32 float tile in shared memory causes bank conflicts when a warp's 32 threads read down a column. What is the common fix?
  5. When multiplying large matrices on a GPU, why are the matrices split into small tiles loaded into shared memory?