CPU vs GPU: Key Architectural and Functional Differences

cpu
gpu
processor
architecture
parallel processing

This article explores the differences between CPUs (Central Processing Units) and GPUs (Graphics Processing Units). We’ll delve into their architectures, capabilities, and how they’re used in modern computing.

The Evolution of Processing

The journey began with the Intel 4004, the first 4-bit CPU. The x86 architecture later gained prominence, followed by ARM’s 32-bit microprocessor, initially developed by Acorn computers. Prior to NVIDIA’s introduction of the “GeForce 256” chip in 1999, graphics processing relied on the VGA (video graphics array) controller. The VGA’s task was to render image data in the correct order for display on the monitor. Initially, GPUs were fixed-function devices, designed for a specific set of tasks. Over time, GPUs evolved to become programmable, much like CPUs. This allowed small GPU programs to run for each vertex, triangle, and pixel, making it easier to generate visual effects quickly and efficiently.

CPU vs GPU: A Detailed Comparison

Let’s break down the core differences between CPUs and GPUs:

  • Architecture: CPUs feature a few powerful cores with substantial cache memory, while GPUs boast hundreds of cores.
  • Parallel Processing: CPUs are designed to handle a limited number of software threads simultaneously. GPUs, on the other hand, can manage thousands of threads concurrently.
  • Task Versatility: CPUs excel at performing a broad range of tasks.
  • Latency: CPUs are more effective at reducing latency for individual tasks.
  • Efficiency: GPUs are typically more power and cost-efficient compared to CPUs.
  • Code Execution: Host code typically runs on the CPU, while CUDA code is executed on the GPU.

Code Example: Array Increment

Here’s a comparison of how an array increment operation is performed on a GPU versus a CPU:

GPU Code:

block = 1:4 by 1:4 if y[i][j]= within block y[i][j] = y[i][j] + 1


**CPU Code:**

for i = 1 to 4 for j = 1 to 4 y[i][j] = y[i][j] + 1


## The Rise of SoCs

Despite the differences, companies are leveraging the strengths of both CPUs and GPUs by developing SoCs (System on Chips) that integrate both components.

![CPU and GPU in NVIDIA TEGRA chip](../../assets/CPU-and-GPU-in-NVIDIA-TEGRA-chip.jpg)

*NVIDIA's Tegra chip, designed for smartphones, exemplifies this integration.*

While CPU manufacturing is dominated by a few players like Intel and AMD, the GPU market boasts a larger variety of vendors. Companies like ARM license their CPU core architecture or offer fixed core designs for sale. This allows manufacturers to combine readily available ARM designs with GPUs and other components or create their own custom CPUs.

The availability of diverse GPU vendors provides companies with the flexibility to select the most suitable GPU for their SoC design, aligning with their specific requirements. Popular GPU vendors include ARM, Qualcomm, PowerVR, and NVIDIA.

## CPUs and GPUs in Smartphones

The following table illustrates the CPUs and GPUs used in various smartphones:

| Smartphone Type      | Chipset                    | CPU                        | GPU                      |
| --------------------- | -------------------------- | -------------------------- | ------------------------- |
| Samsung Galaxy S5    | Qualcomm Snapdragon 801    | Quad-core Krait 400        | Adreno 330 (Qualcomm)     |
| Apple iPhone 5S      | Apple A7                   | Dual core cyclone          | Power VR G6430            |
| Samsung Galaxy Alpha | Exynos 5 Octa 5430        | Quad-core Cortex A15, Quad core Cortex A7 | Mali-T628 MP6           |
| Micromax Canvas Knight | Mediatek 6592T             | Octa-core Cortex A7        | Mali-450MP4               |
| LG G3                | Qualcomm Snapdragon 801    | Quad core Krait 400        | Adreno 330                |

As demonstrated, manufacturers are increasingly adopting SoCs that incorporate both CPU and GPU functionalities on a single chip to capitalize on the benefits of both, delivering enhanced image and video quality across various display devices.

ARM Cortex-M0 vs. M3 vs. M4: Key Differences

ARM Cortex-M0 vs. M3 vs. M4: Key Differences

A comparison of ARM Cortex-M0, M3, and M4 microcontrollers, highlighting their key features, performance, and target applications to aid in selecting the right core.

arm cortex
microcontroller
embedded system
Top 10 ARM Interview Questions and Answers

Top 10 ARM Interview Questions and Answers

Ace your ARM interview with these top 10 questions and answers, covering architecture, power management, and key differences in ARM processors.

arm
interview
embedded system

7 Types of Exceptions in ARM Architecture

An overview of the 7 common exception types in ARM architecture, including Reset, Undefined Instruction, SWI, Aborts, and Interrupt Requests.

arm
exception
interrupt