GPU Programming
When a GPU performs element-wise addition of two large arrays (c[i] = a[i] + b[i]), what mainly determines performance?
- AMemory bandwidth (12 bytes are read and written per element for just one addition)
- BThe number of arithmetic units
- CClock frequency alone
Show answer and explanation
Answer: A. Memory bandwidth (12 bytes are read and written per element for just one addition)
Each float addition reads 4 bytes each from a and b and writes 4 bytes to c, so there is one operation per 12 bytes moved. GPUs can compute tens of trillions of operations per second, but memory bandwidth is only a few TB/s, so this kernel is capped by bandwidth. Speeding up such work means reducing memory traffic, for example by fusing operations so intermediate results are never written to memory.
- A. Correct. Its low arithmetic intensity makes it memory-bound.
- B. The arithmetic units spend most of their time waiting.
- C. Raising frequency does not help memory keep up.