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.1
What is a GPU?
A chip built to do many simple calculations at the same time.
In one line
A GPU (graphics processing unit) is a chip with a huge number of simple workers that do the same kind of small calculation on lots of data at the same time.
Real-life analogy
Our restaurant gets an order for a wedding of 2,000 guests. Every plate needs the same thing: a slice of cake with a strawberry on top.
The head chef (CPU) could do it alone, plate by plate. It would take for ever.
Instead, the restaurant brings in a huge team of helpers. Each helper does one simple job, “put a strawberry on this plate”, and they all do it at once. The whole order is ready in moments.
That team of helpers is the GPU.
Where the comparison stops working: kitchen helpers can each think for themselves. GPU workers are much simpler: they work in groups that follow the same instructions together, each on its own piece of data. Give them a job that is not like that, full of “if this, then that” decisions, and they are not much help.
Diagram
Step by step
In Module 2 we saw that AI requests end up at a server with a GPU. So what is this chip, and why is it different from the CPU?
It started with pictures
Look at your screen. It is made of millions of tiny dots called pixels. To show a moving game or video, the computer must work out the colour of every pixel, many times a second.
Here is the important part: the sum for one pixel is simple, and it is almost the same for every pixel. And pixel number 1 does not need to wait for pixel number 2.
That is the perfect job for many workers at once. So chip makers built a special chip for it: the graphics processing unit, or GPU.
Many simple workers
Where a CPU has a few strong cores, a GPU has a huge number of smaller, simpler ones, able to run thousands of small tasks at the same time.
Each GPU worker is slower and simpler than a CPU core. But because there are so many of them, a GPU can get through a pile of similar, independent calculations much faster than a CPU can.
Doing things “in parallel”
When many pieces of work happen at the same time, we call it parallel work. When they happen one after another, we call it serial work.
- CPU: built to be very fast at serial work and quick decisions.
- GPU: built for parallel work, where one big job splits into thousands or millions of small identical pieces.
Not just for graphics any more
People soon noticed that many other problems look like “the same small sum on lots of numbers”. Science simulations do. And, most importantly for us, AI does.
That is why GPUs are now used far beyond games: in supercomputers, data centres, robots, and the servers that answer your AI questions.
Key takeaways
- A GPU is a chip with a huge number of simple workers.
- It is great at parallel work: the same small calculation on lots of data, all at once.
- It was first built for graphics, where every pixel needs a similar sum.
- The same strength makes GPUs very useful for AI.
Recap: a wedding of 2,000 plates, and a big team of helpers each adding one strawberry at the same time. That is a GPU.
Now you understand what a GPU is and why it was invented. Next, we will put the CPU and GPU side by side and compare them properly.
Quick check
Pick an answer, then press Check answer. Nothing is recorded.
Sources
This lesson was checked against these pages.