Course outline
- 01How a computer works
- 02How the Internet works
- 03Introducing the GPU
- 04Tensors and models
- 4.1What is a tensor?soon
- 4.2What is an AI model?soon
- 4.3Training vs inferencesoon
- 05Splitting work across GPUs
- 5.1Why split work across GPUs?soon
- 5.2Data parallelismsoon
- 5.3Tensor parallelismsoon
- 5.4Pipeline parallelismsoon
- 5.5Expert parallelismsoon
- 5.6Which to use whensoon
- 06Serving LLMs with vLLM
- 6.1What is LLM serving?soon
- 6.2Meet vLLMsoon
- 6.3Serving a model with vLLMsoon
Lesson 3.2
CPU vs GPU
A few strong workers versus many simple workers, and when each one wins.
In one line
A CPU has a few strong workers that are fast at step-by-step work; a GPU has many simple workers that are fast when the same work is done on lots of data at once.
Real-life analogy
Imagine two kitchens.
Kitchen A has 4 master chefs. Each one can cook any dish, handle a tricky special request, and change plans in a second. Perfect for a menu where every order is different.
Kitchen B has hundreds of helpers. Each one only knows a few simple moves, and they work in groups doing the same move together. Useless for a tricky one-off dish, but unbeatable when the order is “peel 10,000 potatoes”.
Kitchen A is the CPU. Kitchen B is the GPU.
Where the comparison stops working: in real kitchens, helpers chat and help each other freely. GPU workers mostly work alone on their own little piece, and sharing results between them takes care. Also, both “kitchens” usually sit inside the same computer and work as a team, which is the topic of lesson 3.4.
Diagram
Step by step
Which is better, a CPU or a GPU? That is the wrong question. The right question is: better at what?
Same chip space, different choices
Every chip has a limited amount of space for its tiny electronic parts. CPU and GPU makers spend that space differently:
- A CPU spends a lot of its space on making a few cores very clever and very quick: big local memory (caches) and smart control parts that keep one line of work flowing fast, even when it is full of decisions.
- A GPU spends most of its space on doing maths: a huge number of simpler workers, so it can run thousands of small tasks at the same time.
The comparison table
| CPU | GPU | |
|---|---|---|
| Workers | A few strong cores | Many simple workers |
| Best at | Step-by-step work, quick decisions | The same work on lots of data at once |
| One task on its own | Very fast | Slower |
| Huge pile of similar tasks | Slower | Very fast |
| Typical jobs | Running the operating system, opening apps, handling requests | Graphics, science simulations, AI maths |
| Restaurant | The head chef | A big team of helpers |
Speed of one vs speed of many
There are two different kinds of “fast”:
- How quickly one task finishes. The CPU wins. If you need one answer right now, a strong core gets it quickly.
- How much work gets done in total. For big piles of similar work, the GPU wins, because thousands of workers are going at once.
Engineers call the first one latency (how long one thing takes) and the second one throughput (how much gets done per second).
Which jobs suit which chip?
Ask two questions about a job:
- Can it be cut into many small pieces that do not need to wait for each other?
- Do all the pieces do roughly the same thing?
If the answer to both is yes, the job suits a GPU. If the work is a long chain of steps where each one depends on the last, or it is full of different decisions, it suits a CPU.
Key takeaways
- CPU: a few strong cores, best at step-by-step work and quick decisions.
- GPU: many simple workers, best at the same work on lots of data at once.
- Latency is how long one task takes (CPU strength); throughput is how much gets done in total (GPU strength).
- They are partners, not rivals.
Recap: four master chefs for a menu full of special requests; hundreds of helpers for 10,000 potatoes.
Now you understand the real difference between a CPU and a GPU, and how to guess which one suits a job. Next: the GPU’s own memory, called VRAM.
Quick check
Pick an answer, then press Check answer. Nothing is recorded.
Sources
This lesson was checked against these pages.