what is the fundamental difference between CPU and GPU when both of them do some calculations ?


what is the fundamental difference between CPU and GPU when both of them do some calculations ?

In: 2

CPU is for running the stuff you look at and click stuff in to open games and apps. Think like the cars and roads that take you to the racetrack.

GPU is more like a racecar. There’s lots of stuff it’s no good at, but the stuff it can do it does better than anything else can do it.

GPUs have specialized hardware, because they are doing *a whole lot* of *the same* calculations. (Specifically, they’re optimized for things like matrix multiplication, since that comes up a *lot* in graphics.) They also tend to have more, slower cores, because many graphics calculations don’t have to be done in order – you can compute basically every pixel in an image almost totally in parallel (and if you can do things in parallel, 2 1GHz processors are better than 1 1.5GHz processor).

CPUs are general purpose, and they usually deal with calculations that have to be done at least partly in order. So they tend to have relatively few cores, and those cores are designed to handle a wide range of calculations.

On the hardware end,

CPUs can handle complex instructions but have only few cores, around 16 or so.

GPUs can handle simple instructions but thousands of cores.

Each core can handle one “calculation” at a time (ignoring pipelining). Having more cores means more parallel computing.

The CPU has a few (1 to 8 typically) processor cores that can each do their own thing. They are designed to do general tasks and lots of different operations, a lot of their time will be spent on the logic of working out what needs to be done rather than doing maths. They have all sorts of special tricks to speed things up like on the fly they can change the order of the operations in the code.

The GPU has lots of cores (hundreds or thousands) that all run the same code on different sections of the same big block of data. They are designed to tasks that are mathematically complicated and require lots of calculation and memory access but far less control logic.

It’s also worth mentioning DSPs (Digital Signal Processors), they have been around for far longer than GPUs and are somewhere in between GPUs and CPUs. They are designed like a GPU to do maths heavy tasks with lots of memory access and minimal control logic and other IO. The difference is that like a CPU they only have a few independent cores rather than lots of grouped ones sharing the same memory.

They can all be made to do the same job, is purely a question of how well they can do it. A CPU is a generalist device, a GPU is a highly optimised device that gains performance in one type of task at the cost of performance at others.

There is no hard line fundamental difference, they are the same basic thing: a processor. A gpu generally is set up to do more of the same thing at once and a cpu is more around doing lots of different things in a row, but they are basically the same general technology