GPU Programming

In a program using a discrete GPU, what is generally true about CPU-side and GPU-side memory?

  1. AThey are separate memories, so data is copied to the GPU before computing and results are copied back afterward
  2. BThey are the same memory, so no copying is ever needed
  3. CThe GPU cannot store results
Show answer and explanation

Answer: A. They are separate memories, so data is copied to the GPU before computing and results are copied back afterward

A discrete GPU has dedicated GDDR or HBM memory on its board, connected to CPU memory over PCI Express or similar. The basic flow is to copy data from CPU memory to GPU memory, launch the kernel, and copy the results back to CPU memory afterward. The time for these copies often determines overall performance.

  • A. Correct. Copies are done with cudaMemcpy or similar.
  • B. A discrete GPU has its own dedicated memory.
  • C. Results are written to GPU memory.
Practice this topic Back to topic

More GPU Programming questions

  1. 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?
  2. Why does pinning (page-locking) CPU memory before transferring it to the GPU speed up the transfer?
  3. What is the main purpose of using multiple CUDA streams?
  4. A program that launches a very small kernel thousands of times in a row is slow. What is the most suitable improvement?
  5. Which describes CUDA unified memory?