A GPU pipeline copies data back to the CPU after every step and is barely faster than pandas. What is wrong?
- Exam domain
- Foundations of Accelerated Data Science12% of the exam
- Difficulty
- Medium
- In this mock
- 6 questions on this domainPractise this domain
Why the exam asks this
Foundations of Accelerated Data Science (12% of the exam)
Objective in the exam guide: CPU vs. GPU workloads and memory transfer optimization
Memory transfer optimization is named.
Why D is the answer
Repeated host-device transfers dominate the run time
Moving data between CPU and GPU memory is slow compared with GPU compute. Keep data on the GPU across steps and transfer once.
Remember: Avoid repeated CPU-GPU transfers.
How it works
GPU speedups come from parallel work on resident data; host-device transfers are costly.
In detail
- Keep data on the GPU.
- Transfer once in, once out.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. The data is in ParquetWrong
Parquet is efficient.
B. The GPU has too many coresWrong
Cores are not the problem.
C. GPUs are always slower than CPUs for tabular work, whatever the data size or stepsWrongMost tempting
GPUs speed up large tabular work.
Why it tempts: A slow result seems to prove GPUs do not help.
D. Repeated host-device transfers dominate the run timeRight
Avoid repeated CPU-GPU transfers.
Use case
An illustrative scenario, not a real incident.
Illustrative: removing six to_pandas calls makes the pipeline eight times faster.
See it in different ways
stateDiagram-v2 state "On CPU" as s0 state "On GPU" as s1 [*] --> s0 s0 --> s1: one transfer s1 --> s1: all steps stay s1 --> s0: final result only
How to read this chart
- It starts at "On CPU".
- From "On CPU", "one transfer" moves it to "On GPU".
- From "On GPU", "all steps stay" moves it to "On GPU".
- From "On GPU", "final result only" moves it to "On CPU".
flowchart TD
Q{"Data size and steps?"}
Q -->|"Small, one step"| A0["CPU may be fine"]
Q -->|"Large, many steps"| A1["GPU, keep data resident"]How to read this chart
- At "Data size and steps?": if "Small, one step", go to "CPU may be fine"; if "Large, many steps", go to "GPU, keep data resident".