GPU Programming

Sending data to a GPU for light work such as adding array elements once can be slower than computing on the CPU. What is the main reason?

  1. AGPUs cannot add
  2. BThe time to copy data over PCI Express exceeds the computation time the GPU saves
  3. CSending data to the GPU changes its values
Show answer and explanation

Answer: B. The time to copy data over PCI Express exceeds the computation time the GPU saves

PCI Express bandwidth is more than ten times lower than GPU memory bandwidth, so just sending the data takes time. With only one addition per element, the computation is tiny compared with the transfer, and the GPU's speed cannot be exploited. GPUs pay off when much computation is done per transferred byte, or when data stays in GPU memory across many processing steps.

  • A. GPUs are excellent at addition.
  • B. Correct. There is too little computation for the transfer.
  • C. Values do not change.
Practice this topic Back to topic

More GPU Programming questions

  1. Why does pinning (page-locking) CPU memory before transferring it to the GPU speed up the transfer?
  2. What is the main purpose of using multiple CUDA streams?
  3. A program that launches a very small kernel thousands of times in a row is slow. What is the most suitable improvement?
  4. Which describes CUDA unified memory?
  5. When a GPU performs element-wise addition of two large arrays (c[i] = a[i] + b[i]), what mainly determines performance?