Lecture-12-PDC - CUDA
Lecture-12-PDC - CUDA
What is a
CPU?
CPU (Central Processing Unit)
CPU multiple
Core
What is a GPU?
• A GPU (Graphics Processing Unit) is a specialized processor designed
to handle graphics and parallel tasks. Unlike a CPU (Central Processing
Unit), which is optimized for general-purpose tasks, a GPU excels at
handling many tasks simultaneously, making it ideal for rendering
images, videos, and computations.
Design Fewer, more powerful cores More cores, less powerful than CPU
cores
Early GPUs
•Basic Graphics: Initially used for simple 2D graphics and basic rendering tasks.
Advancements
•Introduction of 3D Graphics: GPUs started supporting 3D rendering for games and simulations.
•Examples:
IBM's Monochrome Display Adapter (MDA) and VGA (Video Graphics Array).
Maximum CPU cores: 96 cores (AMD EPYC 9654 and AMD Ryzen Threadripper Pro
7995WX)
Maximum GPU cores: 16,896 CUDA cores (NVIDIA H100 "Hopper" GPU)
GPU receives information from CPU as an input and transform it into Image as an
output.
•Pixel Processing: GPU colors pixels with shading, lighting, and textures.
• The CPU (Central Processing Unit) sends instructions and data to the GPU (Graphics
Processing Unit).
• This data includes information about 3D models, such as the positions of their vertices
(corner points), and textures, which are images that cover the surfaces of these
models.
Why CUDA-Python?
•Python is user-friendly and widely used.
•Numba:
•CuPy:
Decorators:
• @cuda.jit:
• Indicates that a function should be compiled for the GPU.
Example
from numba import cuda
@cuda.jit
def gpu_function():