Why do we need to use GPUs instead of CPUs, such as mining or even cracking passwords?

Author: sugar-coated haws baby
link: https: //www.zhihu.com/question/21231074/answer/17598768
Source: know almost
copyrighted by the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.
 

Why is there such a difference between the two? Let's start with the difference between CPU and GPU.

The reason why CPU and GPU are quite different is because of their different design goals. They are aimed at two different application scenarios. The CPU needs strong versatility to handle various data types, and at the same time it requires logical judgment and introduces a large number of branch jumps and interrupt processing. These all make the internal structure of the CPU extremely complicated. The GPU is faced with a highly unified, independent, large-scale data and a pure computing environment that does not need to be interrupted.

So CPU and GPU present very different architectures (schematic diagram):

The picture comes from the nVidia CUDA document. The green one is the computing unit, the orange-red one is the storage unit, and the orange-yellow one is the control unit.

 

GPU uses a large number of computing units and long pipelines, but only has very simple control logic and saves Cache. The CPU not only takes up a lot of space by the Cache, but also has complex control logic and many optimization circuits. In contrast, the computing power is only a small part of the CPU.

Therefore, unlike CPUs that are good at logic control and general data operations, GPUs are good at large-scale concurrent computing, which is exactly what is needed for password cracking. Therefore, in addition to image processing, GPU is increasingly involved in calculations.

 

Author: rabbit
link: https: //www.zhihu.com/question/21231074/answer/20729629
Source: know almost
copyrighted by the author. For commercial reprints, please contact the author for authorization, and for non-commercial reprints, please indicate the source.
 

From the performance point of view, the programs running on the computer can be roughly divided into three categories: (1) I/O intensive; (2) Memory intensive and (3) Compute-intensive .

(1) The performance bottleneck of I/O intensive programs is I/O, which means that most of the time the program runs is spent on hard disk reading and writing/network communication, and I/O is at the bottom of the computer architecture pyramid , The speed is very slow. This type of application is being discussed by big data, which has been very hot recently. Hundreds of terabytes or even petabytes of data can only be stored on the hard disk. What if the capacity of a machine is too small and the CPU is too few? Use hundreds or even thousands of machines to connect with a network cable for distributed processing. So this block is all I/O. Nowadays, big Internet companies don't build clusters with thousands of nodes. They will definitely not be able to support it.

(2) The performance bottleneck of Memory intensive programs is memory access. There are a large number of random access memory operations in the program, but there is basically no I/O. This type of program is an order of magnitude faster than the first type of program, but it is not related to the register. The speed is still incomparable. Most applications currently fall into this category. All kinds of software installed in personal computers are basically of this type. If there is a bit of I/O, it will be very stuck immediately.

The two types of programs mentioned above are the most widely used and cover most of the useful computer software. Unfortunately, the GPU is useless in these two areas, and the GPU is only useful for computationally intensive programs. I/O is a bottleneck program, and the time spent on calculation is negligible, and no matter how GPU acceleration is used, it is useless. Programs with a large amount of random access to memory are not suitable for execution on the GPU, and a large amount of random access can even change the behavior of the GPU from parallel to serial.

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) Programs that are easy to parallelize. 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.

 

Generally speaking, the GPU is good at and only large-scale parallel computing, and tasks that cannot be executed in parallel or tasks related to control are far away from the GPU. The GPU is just a calculator, and computationally intensive parallel computing tasks can be assigned to it, but the CPU is the core of the entire computer for calculation and control

 

 

 

Guess you like

Origin blog.csdn.net/shenwansan_gz/article/details/110930163