CPU and GPU are very different, because of their design goals, they are specific to two different scenarios. The CPU needs a lot of versatility to handle a variety of different data types, while at the same time logical judgment introduces a large number of branch jumps and interrupt processing. All of this makes the internal structure of the CPU extremely complex. The GPU is faced with a highly unified, interdependent, large-scale data and pure computing environment that does not need to be interrupted.
So the CPU and GPU are showing very different architectures ():
Pictures from the NVIDIA Cuda documentation. The green is the calculation unit, orange red is the storage unit, Orange yellow is the control unit.
The GPU employs a large number of computational units and an ultra-long pipeline, but with very simple control logic and eliminates the cache. The CPU is not only a lot of space by the cache, but also has complex control logic and many optimization circuits, in contrast to the computing power is only a small part of the CPU
It can be seen from:
Cache, local memory:cpu > GPU
Threads (number of threads): GPU > CPU
Registers:gpu > CPU Multiple registers can support a very large number of thread,thread need to use Register,thread, the register must be followed very large.
SIMD Unit (single instruction multi-stream, synchronous, executing the same instruction at the same time): GPU > CPU.
The CPU is based on a low-latency design:
The CPU has a powerful ALU (arithmetic unit) that can perform arithmetic calculations in very few clock cycles.
Today's CPUs can reach 64bit double precision. The addition and multiplication of double-precision floating-point source arithmetic requires only one clock cycle.
The frequency of the CPU's clock cycle is very high, reaching 1.532~3gigahertz (gigabit Hz, 10 of 9).
A large cache can also reduce latency. Save a lot of data in the cache, when you need to access the data, as long as the previous access, and now directly in the cache to take it.
A complex logic control unit. When a program has multiple branches, it reduces latency by providing the ability to predict branches.
Data forwarding. When some instructions depend on the result of the preceding instruction, the logical control unit of data forwarding determines the position of these instructions in pipeline and forwards the result of an instruction as soon as possible to the subsequent instruction. These actions require a lot of contrast circuit units and forward circuit units.
The GPU is based on a large throughput design.
The GPU features a lot of Alu and very few caches. The purpose of caching is not to save the data that needs to be accessed later, which is different from the CPU, but for the thread to improve the service. If there are many threads that need access to the same data, the cache merges those accesses and then accesses the DRAM (because the data that needs to be accessed is stored in DRAM instead of the cache), and the cache forwards the data to the corresponding thread, which is the role of data forwarding. However, due to the need to access the DRAM, nature will bring a delay problem.
The control unit of the GPU (the yellow area on the left) can combine multiple accesses into less access.
Although the GPU has a dram delay, it has a lot of alu and a lot of thread. For the balance memory delay problem, we can make full use of the characteristics of many Alu to achieve a very large throughput effect. Allocate as many threads as possible. Usually the GPU Alu will have a very heavy pipeline because of this.
So with the CPU is good at logic control, serial operation. Unlike common type data operations, GPUs excel at large-scale concurrency calculations, which are needed for password cracking. So GPU, in addition to image processing, is more and more involved in the calculation.
Most of the work of the GPU is like this, computationally large, but with little technical content and repeated many times. It's like you have a job that needs to be counted hundreds of millions of times. 100 within subtraction, the best way is to hire dozens of pupils together, a part of the calculation, anyway, these calculations are not technical content, purely physical life. And the CPU is like the old professor, the integral differential will be counted, is the high salary, an old professor Top 20 pupils, you if Foxconn you hire Which? The GPU is like this, with a lot of simple computational units to complete a lot of computational tasks, pure human sea tactics. This strategy is based on the premise that the work of primary school A and pupil B is not dependent on each other and is independent of each other. Many of the problems that involve a lot of computation are basically the same, such as what you mean by cracking passwords, mining, and many graphical calculations. These calculations can be broken down into the same simple small tasks, each of which can be assigned to a pupil. But there are some tasks that involve the "flow" problem. For example, you go blind Date, both sides look pleasing to the eye to continue to develop. Can not you have not met on this side, there will be someone to get the card. This more complex problem is done by the CPU.
All in all, the CPU and GPU are different from the tasks that were originally used for processing, so there is no small difference in design. Some tasks are similar to the problems that the GPU originally used to solve, so use the GPU instead. The speed of the GPU depends on how many pupils you hire, and how fast the CPU is calculated depends on how powerful the professor is. The professor's ability to handle complex tasks is to crush pupils, but for less complex tasks, there is no more. Of course, now the GPU can do a little more complicated work, equivalent to upgrade to junior high school students level. But it also requires the CPU to feed the data to the mouth to start work, or on the CPU to control.
What type of program is suitable for running on the GPU?
(1) computationally intensive programs. The so-called computationally intensive (compute-intensive) program is that most of its run time is spent on register operations, with registers that are at the same speed as the processor, with little delay in reading and writing data from the registers. Can do a comparison, read memory latency is about hundreds of clock cycles, read the speed of the hard disk is not said, even the SSD, it is too slow.
(2) Easy to parallel program. The GPU is actually a SIMD (single instruction multiple Data) architecture that has hundreds of cores, each of which is best able to do the same thing at the same time.
1.2CPU and GPU Design differences