GPU Programming

Which characteristic best describes work that GPUs process quickly?

  1. AA single chain of sequential computation where each step uses the previous result
  2. BApplying the same, mutually independent computation to each element of a large data set
  3. CA small amount of data with a great many conditional branches
Show answer and explanation

Answer: B. Applying the same, mutually independent computation to each element of a large data set

GPUs assign the same work to thousands of threads running in parallel, so they excel at tasks where many elements can be computed independently (data parallelism), such as per-pixel image processing, matrix multiplication and vector operations. Sequential computation that depends on prior results, or branchy work on little data, offers little parallelism and often runs faster on a CPU.

  • A. Sequential work cannot be parallelized, so a CPU is better.
  • B. Correct. It suits data-parallel work.
  • C. Many branches reduce GPU efficiency.
Practice this topic Back to topic

More GPU Programming questions

  1. Which processing tends to run inefficiently on a GPU?
  2. In GPU programming such as CUDA, what is a "kernel"?
  3. Which correctly orders the CUDA thread hierarchy from largest to smallest?
  4. A CUDA kernel computes each thread's index i with the expression above. What is i for the thread with blockIdx.x = 2, blockDim.x = 256 and threadIdx.x = 5?
  5. To process a 1000-element array with one element per thread and 256 threads per block, how many blocks should be launched?