The difference between GPU and CPU

CPU stands for central processing unit, and GPU stands for graphics processing unit.
You can read this article for details:

https://www.cnblogs.com/biglucky/p/4223565.html

What I said earlier is more professional, and I don't quite understand it. I can understand the following paragraphs. as follows:

So it is good at logic control and serial operation with CPU. Unlike general-purpose data operations, GPUs are good at large-scale concurrent computing, which is exactly what is needed for password cracking and so on. Therefore, in addition to image processing, GPU is increasingly involved in calculations.

Most of the work of GPU is like this, the calculation is large, but there is no technical content, and it has to be repeated many, many times. Just like if you have a job that requires 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 one person counts part. Anyway, these calculations have no technical content and are purely physical work. The CPU is like an old professor, integral and differential will be counted, that is, the salary is high. An old professor is worth 20 elementary school students. If you are Foxconn, which one would you hire? GPU is like this, using many simple computing units to complete a large number of computing tasks, purely crowded tactics. This strategy is based on the premise that the work of elementary student A and elementary student B are independent of each other. Many problems involving a large number of calculations basically have this feature, such as cracking passwords, mining and many graphics calculations. These calculations can be broken down into multiple identical simple small tasks, and each task can be assigned to a primary school student to do it. But there are still some tasks that involve the issue of "flow". For example, if you go to a blind date, both parties can continue to develop if they look pleasing to the eye. Can't you have not met here yet, and find someone over there to get all the certificates. This kind of more complicated problem is done by the CPU.

All in all, because the tasks that CPU and GPU are used to process are different at first, there is a big difference in design. And some tasks are similar to the problem that the GPU originally used to solve, so use the GPU to forget it. The computing speed of the GPU depends on how many elementary school students are hired, and the computing speed of the CPU depends on how powerful a professor is hired. The professor's ability to handle complex tasks crushes elementary school students, but for tasks that are not so complex, they still can't stand the crowd. Of course, the current GPU can also do some slightly complicated tasks, which is equivalent to upgrading to the level of junior high school students and high school students. But it still needs the CPU to feed the data to the mouth before it can start to work, and it is the CPU that takes care of it.

What type of program is suitable to run on the GPU?

  • (1) A computationally intensive program. The so-called Compute-intensive program means that most of its running time is spent on register operations. The speed of the register is equivalent to the speed of the processor, and there is almost no delay in reading and writing data from the register. For comparison, the latency of reading memory is about a few hundred clock cycles; not to mention the speed of reading hard disk, even for SSD, it is too slow.
  • 2) Easy to parallel programs. GPU is actually a SIMD (Single Instruction Multiple Data) architecture. It has hundreds or thousands of cores, and it is best for each core to do the same thing at the same time.

Guess you like

Origin blog.csdn.net/Gou_Hailong/article/details/113308630