GPU Programming

Which describes memory coalescing on a GPU?

  1. ACombining two GPUs' memories into one to double capacity
  2. BCompressing memory data to increase capacity
  3. CWhen adjacent threads in a warp read adjacent addresses, the reads are combined into a few memory accesses
Show answer and explanation

Answer: C. When adjacent threads in a warp read adjacent addresses, the reads are combined into a few memory accesses

GPU memory is read and written in chunks such as 32 or 128 bytes. If the 32 threads of a warp each read 4 consecutive bytes, the 128 bytes together are fetched in one or a few accesses. With scattered addresses, each thread needs a separate chunk and unused data is carried along, cutting effective bandwidth to a fraction.

  • A. It is not about merging capacity.
  • B. It is unrelated to compression.
  • C. Correct. It is fundamental to using bandwidth effectively.
Practice this topic Back to topic

More GPU Programming questions

  1. With i as each thread's index, reading the array every 32 elements as above is slower than reading a[i]. What is the main reason?
  2. When processing particle data with positions x, y and z on a GPU, which layout is better for memory coalescing?
  3. What is a characteristic of CUDA shared memory?
  4. What does CUDA's __syncthreads() do?
  5. In CUDA, __syncthreads() is placed inside "if (threadIdx.x < 16)" so that only some threads reach it. What can happen?