Pettigrew Lab

CPU vs. GPU: what’s the difference?

By Joel Pettigrew

A CPU, the processor, has a few powerful cores that can handle any task, one complicated step after another. A GPU, the graphics processor, has thousands of small, simple cores that all do the same calculation at the same time. That makes the GPU perfect for drawing millions of pixels, and it turned out to be perfect for training AI too.

What a CPU does

The CPU runs a loop forever: fetch the next instruction, decode it, execute it. It’s built to be good at anything, including long chains of decisions where each step depends on the last. Running the operating system, opening a document, and working out the rules of a game are CPU work.

Most CPUs today have somewhere between 4 and 16 cores, each a complete processor.

What a GPU does

Drawing one frame of a game means working out the color of about two million pixels on a 1080p screen, sixty or more times a second. Each pixel can be worked out on its own, so a GPU hands one to each of its thousands of cores and does them all together. It’s worse than a CPU at complicated one-at-a-time work and far better at the same simple job done millions of times.

Why AI runs on GPUs

Training an AI model is mostly multiplying huge grids of numbers, over and over. That has the same shape as drawing pixels: the same math, on a huge pile of data, all at once. In 2012, a neural network trained on two ordinary gaming graphics cards won a famous image contest by a wide margin, and AI researchers have bought GPUs ever since.

Integrated or dedicated?

  • Integrated graphics

    A GPU built into the main processor chip. Fine for email, homework, video and light games.

  • Dedicated graphics

    A separate, much more powerful GPU with its own memory. For modern 3D games, video editing and running AI tools yourself.

Questions people ask

Do I need a dedicated graphics card?

Only for heavy visual work: new 3D games, video editing with effects, 3D modeling or running AI on your own computer. For everything else, the graphics built into the processor are enough.

Can a GPU replace a CPU?

No. Every computer needs a CPU to run the operating system and handle step-by-step work. The GPU is a specialist the CPU hands certain jobs to.

Learn it by taking one apart

The app teaches the CPU in Modules 6 and 7, with a pretend processor you step through yourself, and the GPU in Module 12, A Thousand Tiny Painters, with a race between the two.

How Computers Work is a course in five-minute lessons, with something to play with in every one and an old laptop the crew fixes along the way. Part I is free. Coming soon to iPhone, iPad and Android; the toys on the course page work right now.

Keep going