Why GPU can be used to accelerate the computing speed of artificial intelligence or machine learning (parallel computing power)
1. Why GPU
In fact, GPU computing is not "better" than CPU, but "faster".
Calculation is calculation. Mathematically, it is the same. 1+1 is calculated as 2. The CPU can also calculate the neural network. The calculated neural network works well in practical applications, but the speed will be very slow. That's it.
Origin of GPU
The full name of GPU is called graphics processing unit, graphics processor, as the name implies, it processes graphics.
The image displayed on the computer monitor must undergo a series of processing before being displayed on the monitor. This process has a proper name called "rendering". There was no GPU on previous computers, rendering was done by the CPU. What is rendering? In fact, it is a series of graphics calculations, but these calculations are often very time-consuming and take up a large part of the CPU time. And the CPU also handles many other tasks of the computing machine. Therefore, a processor is specially designed for these operations of graphics processing, that is, GPU. This frees the CPU from heavy graphics calculations.
Since the GPU is specially designed for rendering, it can only do the things that render.
The rendering process is specifically the calculation of the position and color of geometric points, both of which are mathematically multiplied by four-dimensional vectors and transformation matrices, so the GPU is designed as a dedicated processor suitable for similar operations. . Why is it dedicated, because there are many things he can't do.
The CPU has strong versatility, but the performance in the dedicated area is low. Engineering is a compromise. If one is strong, the other is weak. Later, games and 3D design have higher and higher requirements for rendering, and the performance of GPU is getting stronger and stronger. In terms of pure theoretical computing performance, it is dozens or hundreds of times higher than CPU.
People thought, since the GPU is so powerful, can the speed of the GPU be greatly improved compared to the CPU? So there is the concept of GPGPU (general purpose GPU, general computing GPU). But as we mentioned earlier, the GPU is specially designed for image rendering, and it is only suitable for those operations. But luckily there are some operations that are very similar to what GPUs are supposed to do, so you can speed things up with GPUs, such as deep learning.
A type of successfully applied technology in deep learning is called convolutional neural network CNN, which mathematically is a combination of many convolution operations and matrix operations, and convolution operations can also be completed by matrix operations through certain mathematical means. These operations are the same as those matrix operations on graphics points that the GPU can do otherwise. So deep learning can be very appropriately accelerated with GPUs.
In the past, the concept of GPGPU (General Purpose GPU) was not very popular, and GPU was designed for graphics rendering. If you want to use GPU-assisted computing, you must fully follow the hardware architecture of the GPU. Now that GPGPU is becoming more and more popular, manufacturers will also take care of the needs of the computing field when designing and producing GPUs. For example, when Nvidia released the M40 and P100 this year, they were talking about "designing for deep learning". Of course, the concept of speculation here is even bigger, but at least it can be seen that manufacturers are paying more and more attention to general-purpose GUGPU computing.
Second, the difference between GPGPU and GPU
The GPU was created to solve the problem of graphics rendering efficiency, but with the advancement of technology, the GPU has become more and more powerful, especially after the appearance of the shader (this allows us to program on the GPU), the GPU can do more and more things, not If it is limited to the graphics field, some people will expand its capabilities to other computing-intensive fields, which is GP (General Purpose) GPU.
3. Why fast
For example, when you use Meitu xx software to add a blur effect to a picture, the CPU will do the following:
Use a small window of the blur filter operator, start processing from the upper left corner of the image, and move from left to right, and then from left to right until the entire image is processed. Because the CPU has only one or a few cores, when performing this operation, it can only traverse from the beginning to the end honestly.
But some smart readers will find that each window is independent and has nothing to do with each other in the process of processing pictures. So is it faster to use several filter windows at the same time? So we have a GPU. Generally, GPUs have hundreds of cores, which means that we can have hundreds of filter windows to process this image at the same time. picture.
Therefore, the original design goal of the GPU is to handle the rendering of this kind of graphics and images, and the characteristics of this work are that it can be distributed, and each processing unit is relatively independent, and there is not much correlation. And some machine learning algorithms, such as genetic algorithms, neural networks, etc., also have this distributed and locally independent characteristics (e.g. for example, a link in a neural network and another link are calculated at the same time, and mutually There is no dependency between them), in this case, a large number of small cores can be used at the same time to speed up the operation.
Copyright statement: This article is an original article by CSDN blogger "xihuanyuye" and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/xihuanyuye/article/details/81178352
Open-pit mining is a project to extract useful minerals in the crust from the surface down in an open environment with the help of mining, excavation and transportation equipment.