What is CPU?
CPU (Central Processing Unit-Central Processing Unit) is a very large-scale integrated circuit, which is the computing core (Core) and control core (Control Unit) of a computer. It consists of two parts: the arithmetic unit (ALU) and the controller (CU). In addition, there are several registers and cache memories and data, control, and status buses that communicate between them. The main function of the CPU is to interpret computer instructions and process data in computer software.
What is GPU?
GPU (Graphics Processing Unit-graphics processing unit) , also known as display core, graphics card, visual processor, display chip or graphics chip, is a microprocessor that specializes in image computing work on personal computers, workstations, game consoles, and some mobile devices (such as tablets, smartphones, etc.). GPU is not only widely used in image processing, but also in scientific computing, password cracking, numerical analysis, big data processing, financial analysis and other fields that require parallel computing.
CPU vs GPU – what is the difference?
Cache
● The CPU has a large number of cache structures. At present, mainstream CPU chips have four-level caches. These cache structures consume a lot of transistors and require a lot of power when running.
● However GPU cache is very simple. At present, the mainstream GPU chip has at most two layers of cache, and the GPU can use the space and energy consumption on the transistor to make an ALU unit . So GPU is more efficient than CPU.
Response
● The CPU requires real-time response, and has high requirements for the speed of a single task, so a multi-layer cache method will be used to ensure the speed of a single task.
● The GPU arranges all the tasks and then batch processes them, so the requirements for the cache are relatively low.
Floating-point calculation method
● The CPU is versatile, and its emphasis is on single-threaded performance. To ensure that the instruction flow is not interrupted, more transistors and energy consumption need to be used in the control part, so the CPU allocates less power consumption in floating-point calculations.
● GPU basically only performs floating-point calculations, and the design structure is simple, so it can be done faster. The GPU focuses on throughput. A single instruction can drive more calculations. Compared with the GPU, the energy consumption in the control part is relatively small, so the resources saved in electricity can be used for floating-point calculations.
CPU vs GPU – different applications
The main work of the GPU is 3D image processing and special effects processing. For 2D graphics, the CPU can easily handle them, but for complex 3D images, the CPU will spend a lot of resources to process them, which will obviously reduce the work efficiency of other aspects, so this kind of work is handed over to the GPU for processing.
Some high frame rate game screens and high-quality special effects are also handed over to the GPU to share the work of the CPU. In addition, GPU is widely used in password cracking, big data processing, financial analysis and other fields by virtue of its parallel processing capability.
Why are GPUs so good at processing image data? This is because every pixel on the image needs to be processed, and the process and method of processing each pixel are very similar.
But the GPU cannot work alone, it must be controlled by the CPU to work. The CPU can act alone to handle complex logical operations and different data types . However, when a large amount of processing data of a uniform type is required, the GPU can be called for parallel computing.
The GPU uses a large number of computing units and an ultra-long pipeline, but only has very simple control logic and saves the Cache. The CPU not only occupies a lot of space in the Cache, but also has complex control logic and many optimized circuits. In contrast, the computing power of the GPU is only a small part of the CPU.
The CPU is based on a low-latency design, and the CPU has a powerful ALU, which can complete arithmetic calculations in very few clock cycles.