The difference between cpu and gpu

1. Internal composition of CPU and GPU

insert image description here
As shown in the figure above, the internal composition of the CPU and GPU can be seen to be composed of different architectures

CPU: called the central processing unit (central processing unit), as the computing and control core of the computer system, is the final execution unit of information processing and program operation

It can be vividly understood that there are 25% of ALU (computing unit), 25% of Control (control unit), and 50% of Cache (cache unit).

Because the CPU involves general-purpose calculations, the complexity is high——summarized into a small amount of complex calculations

  1. It requires a small number of computing units and powerful logical computing capabilities. It can be understood as 4 experts, who can not only do Olympiad problems, but also do addition and subtraction.
  2. Need enough control units to realize complex data control and data forwarding
  3. Need enough cache units to store some calculated results, or data that will be used soon

GPU: called a graphics processing unit. Graphics Processing Unit (English: Graphics Processing Unit, abbreviation: GPU)

Also known as display core, visual processor, and display chip, it is a microprocessor that specializes in image and graphics-related computing work on personal computers, workstations, game consoles, and some mobile devices (such as tablets, smartphones, etc.).

It can be vividly understood as 90% ALU (computing unit), 5% Control (control unit), and 5% Cache (cache unit)

The design principle of GPU - summed up as a large number of simple operations

  1. A large number of calculation units: responsible for simple and rough calculations, not good at Olympiad questions, but he can solve elementary school questions
  2. A small number of control units and cache units: mainly responsible for merging and forwarding data, the demand for these two units is small, so it occupies a small space on the GPU
    insert image description here

2. Characteristics of GPU and CPU

2.1. Comparison of calculation amount

  • CPU: small amount of calculation, principle: only 4 computing units
  • GPU: large amount of calculation, principle: there are 1000 computing units

2.2. Computational complexity comparison:

  • CPU: It can calculate complex calculations, such as integral and differential, and the 4 calculation units are all at the expert level
  • GPU: It can only calculate simple 1+1 arithmetic problems, but cannot calculate complex differential integrals. 1000 computing units are at the level of primary school students.

2.3. Comparison of calculation speed for a single integral and differential

  • CPU: faster. Principle: Single-threaded computing (such as robot motion control), a single chip has strong performance, strong computing power, and can calculate
  • GPU: slow, may not even be able to calculate; principle: a single chip has weak performance and weak computing power, may not be able to calculate, or the speed is very slow

2.4. Comparison of calculation speed for multiple 1+1 arithmetic problems

  • CPU: slower. Because the calculation principle is: first calculate the first question, and then calculate the second question, the total time is [T1+T2+T3>>>+T1000 (that is, the accumulation of the time consumed by 1000 arithmetic problems])]
  • GPU: Fast. Because the calculation principle is: 1000 arithmetic problems can be calculated at the same time, and the total time is [max (T1, T2, T3...T1000) (that is, the maximum value of the time consumed by 1000 arithmetic problems)]

2.5, image metaphor

  1. GPU: The calculation is heavy, but there is no technical content, and it has to be repeated many times. Just like you have a job that needs to calculate hundreds of millions of additions, subtractions, multiplications and divisions within 100, the best way is to hire dozens of elementary school students to do the calculations together, and each person does a part. Anyway, these calculations have no technical content and are purely physical work.
  2. CPU: Like an old professor who can calculate integrals and differentials, but the salary is high. An old professor is worth 20 elementary school students. If you were Foxconn, who would you hire? GPU is like this, using many simple computing units to complete a large number of computing tasks, purely crowd tactics.

insert image description here

3. Applicable scenarios

  • CPU: Suitable for computing scenarios that require close correlation between previous and subsequent calculation steps. These tasks involve the problem of "flow", and the first step must be calculated first, and then the second step is calculated; for example, if you go on a blind date, both parties can only continue to develop if they look pleasing to the eye. It can't be that you haven't met here yet, and you can find someone to collect the certificates over there. This kind of more complicated problem is done by the CPU, which is used in most of life, such as the motion control of weapons and equipment, the use of personal computers, etc.
  • GPU: It is suitable for computing scenarios where the front and back calculation steps have no dependencies and are independent of each other. Many problems involving a large amount of calculation basically have this characteristic, such as the password cracking you mentioned, mining and many graphics calculations. These calculations can be decomposed into multiple identical simple small tasks, and each task can be assigned to a primary school student

If you buy a computer, your demand for the computer is to pursue excellent game images and high-quality images. It is recommended to choose a GPU (also called an image processor or graphics card) that is awesome, which will greatly increase your gaming experience, because your computer The rendering effect of all color pixels in the image requires GPU to do a lot of parallel computing

Guess you like

Origin blog.csdn.net/weixin_45277161/article/details/130698097