0% found this document useful (0 votes)
12 views

Lecture-12-PDC - CUDA

cuda

Uploaded by

215059
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lecture-12-PDC - CUDA

cuda

Uploaded by

215059
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

PARALLEL AND DISTRIBUTED COMPUTING

GPU & CUDA


IN TODAY’S LECTURE WE WILL LEARN ABOUT

• Parallel and Distributed Computing


• CPU
• GPU
• CUDA

Presenter - M.Imran | PDC 2


CPU

What is a
CPU?
CPU (Central Processing Unit)

•Purpose: The general-purpose processor of a computer.

•Functionality: Executes instructions sequentially, handling a few


tasks rapidly.

•Example: Running your operating system, opening programs,


and performing calculations.

Presenter - M.Imran | PDC 3


CPU

CPU multiple
Core

Presenter - M.Imran | PDC 4


GPU

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.

• Example: Rendering images in a video game quickly so that motion


appears smooth.

Presenter - M.Imran | PDC 5


GPU

• Yearly back – only used for rendering Images, Videos.

• Nowadays: use for ML, AI and financial applications.

Presenter - M.Imran | PDC 6


CPU vs GPU
CPU GPU

Presenter - M.Imran | PDC 7


CPU vs GPU
Feature CPU GPU

Function Generalized component that deals Specialized component great for


with the main processing functions of parallel computing
a computer

Processing Runs processes serially Runs processes in parallel

Design Fewer, more powerful cores More cores, less powerful than CPU
cores

Emphasis Low latency High throughput

Use Case General-purpose computing devices High-performance computing devices

Presenter - M.Imran | PDC 8


The Evolution of GPUs

Early GPUs

•Basic Graphics: Initially used for simple 2D graphics and basic rendering tasks.

•Limited Capability: Could not handle complex computations or 3D graphics.

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).

Presenter - M.Imran | PDC 9


The Evolution of GPUs

Graphics Card CUDA Cores Thread Support


GeForce RTX 4060 3,072 Approx. 98,304
GeForce RTX 3060 Ti 4,864 Approx. 155,648
GeForce RTX 3080 8,704 Approx. 278,528
GeForce RTX 3090 10,496 Approx. 335,872
GeForce RTX 4090 16,384 Approx. 524,288

Presenter - M.Imran | PDC 10


Current CPU & GPU Cores

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)

Presenter - M.Imran | PDC 11


GPU Manufactures

Presenter - M.Imran | PDC 12


GPU Pipeline

GPU receives information from CPU as an input and transform it into Image as an
output.

This all happens using below mentioned GPU pipeline:

Presenter - M.Imran | PDC 13


GPU Pipeline

•Host Interface: CPU sends data to GPU.

•Vertex Processing: GPU transforms and positions vertices.

•Triangle Setup: GPU forms triangles from vertices.

•Pixel Processing: GPU colors pixels with shading, lighting, and textures.

•Memory Interface: GPU stores the final image in memory to display.

Presenter - M.Imran | PDC 14


GPU Pipeline
1. Host Interface: The Conversation Between CPU and GPU

What Happens Here:

• 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.

Presenter - M.Imran | PDC 15


GPU Pipeline

2. Vertex Processing: Shaping and Positioning Objects

What Happens Here:


• The GPU processes each vertex of the 3D models.
• It performs mathematical transformations to position, rotate, and scale objects within
a 3D space.
• The GPU also adjusts vertices based on the viewer's perspective, so objects appear
correctly from the camera's point of view.

Presenter - M.Imran | PDC 16


GPU Pipeline

3. Triangle Setup: Creating Surfaces from Points

What Happens Here:


• 3D models are made up of triangles because computers work efficiently with them.
• The GPU takes the processed vertices and assembles them into triangles.
• It determines how these triangles should be drawn on the screen, including their size
and shape after transformations.

Presenter - M.Imran | PDC 17


GPU Pipeline
4. Pixel Processing: Coloring and Texturing

What Happens Here:


• The GPU decides the color of every pixel (the tiny dots that make up your screen)
inside the triangles.
• It applies lighting effects, shading, and textures to make the image look realistic or
stylized.
• This process can include complex calculations for shadows, reflections, and surface
properties.

Presenter - M.Imran | PDC 18


GPU Pipeline
5. Memory Interface: Storing the Final Image

What Happens Here:


• The GPU writes the final pixel data to a specific area of memory called the
framebuffer.
• The framebuffer holds the complete image until it's time to display it on the screen.
• This allows the GPU to work on rendering images while previous ones are being
displayed.

Presenter - M.Imran | PDC 19


CUDA

• CUDA – Computer Unified Device Architecture


• A powerful software platform that helps computer programs run faster.
• Often used to solve performance-intensive problems such as:

Presenter - M.Imran | PDC 20


CUDA

• CUDA is not just software- coding also embedded in hardware:

Presenter - M.Imran | PDC 21


CUDA

• NVidia Graphics card users can access it.

Presenter - M.Imran | PDC 22


CUDA-python

Why CUDA-Python?
•Python is user-friendly and widely used.

•Combines Python's simplicity with GPU performance.

Tools for CUDA-Python:

•Numba:
•CuPy:

Presenter - M.Imran | PDC 23


CUDA-python
Numba Library:
• Accelerates Python applications by compiling code at runtime.
• Supports CUDA GPU programming with minimal code changes.

Decorators:
• @cuda.jit:
• Indicates that a function should be compiled for the GPU.

Example
from numba import cuda

@cuda.jit
def gpu_function():

# GPU code here

Presenter - M.Imran | PDC 24


ANY QUESTION…?

Presenter - M.Imran | PDC 25

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy