SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Uvod u
GPGPU
programiranje
Elektronski fakultet Niš
16.04.2015.
dr Dušan Gajić
• Commodore Amiga - 1985.
• Nvidia GeForce 256 - 1999.
• Industrija video igara
• GPU danas: PC, tablet, smartphone, konzole…
• Heterogeni računarski sistemi
(CPU, GPU, DSP, FPGA…)
Kratka istorija GPU
brza evolucija GPU
Savremene GPU arhitekture
Manycore arhitekture
43 51 55 58 86 187 225 225 225
518 576 648
1062
1581
2488
3090
4500
5632
0
1000
2000
3000
4000
5000
6000
2006 2007 2008 2009 2010 2011 2012 2013 2014
moćobrade[GFLOPS]
godina
CPU GPU
Moć obrade CPU i GPU
10
26 26 32 32 32
51 51 51
90
108
142
159
177
192 192
288
336
0
50
100
150
200
250
300
350
2006 2007 2008 2009 2010 2011 2012 2013 2014
propusniopseg[GB/s]
godina
CPU GPU
Propusnu opseg CPU i GPU
CPU – von Neumannova arhitektura
GPU – SIMD arhitektura
1. Zahtevaju kompleksna i obimna izračunavanja
2. Omogućavaju značajan paralelizam
3. U većoj meri zavise od propusne moći
nego od latencije
Problemi pogodni za GPU
Intenzitet izračunavanja
CPU GPU
ulazni
podaci
izračunati
rezultati
ulazni
bafer
1
2
GPU izvršava kernel sa velikim
brojem paralelnih niti3
izlazni
bafer
4
Rad GPGPU programa
Struktura GPGPU programa
Elementi rada GPGPU programa
2000 2005 2007 2015
Programski jezici za GPGPU
+ visoke performanse
+ razvijeni alati za programiranje
i optimizaciju
- radi isključivo na Nvidia GPU
+ radi na širokom spektru procesora
(AMD i Nvidia GPU, DSP, FPGA...)
- slabije razvijeni alati i nešto
niže performanse programa
Programski jezici za GPGPU
• CUDA C i OpenCL C zasnovani na C99 ISO standardu
• Specijalne ključne reči i dodatne funkcije za podršku
paralelnom programiranju:
kernel, global, shared, sync, get_global_id, ...
• Određena ograničenja (npr. zabrana rekurzije) i
specifičnosti (eksplicitna specifikacija tipa memorije)
Programski jezici za GPGPU
Primer: sekvencijalno množenje
dva vektora u C-u na CPU
void addCPU(int* c, const int* a, const int* b)
{
unsigned int i;
for (i = 0; i < n; i++)
{
c[i] = a[i] + b[i];
}
}
#include “cuda_runtime.h”
#include “device_launch_parameters.h”
…
void main()
{
…
cudaMalloc((void**)&a, size*sizeof(int));
…
cudaMemcpy(a, input, size*sizeof(int), cudaMemcpyHostToDevice);
…
dim3 gridDim(1,1,1);
dim3 blockDim(N,1,1);
addGPU<<<gridDim, blockDim>>>(c, a, b);
cudaMemcpy(c, output, size*sizeof(int), cudaMemcpyDeviceToHost);
…
}
Primer: host CUDA program (CPU)
__global__ void addGPU(int* c,
const int* a,
const int* b)
{
const unsigned int tid = threadIdx.x;
c[tid] = a[tid] + b[tid];
}
Primer: paralelno množenje
dva vektora – CUDA na GPU
__kernel void addGPU(__global int* c,
__const int* a,
__const int* b)
{
const unsigned int tid = get_global_id();
c[tid] = a[tid] + b[tid];
}
Primer: paralelno množenje
dva vektora – OpenCL na GPU
• Program domаćina (host) i
program uređaja (device)
• Kernel opisuje operacije koje realizuje jedna nit
• Broj niti po bloku i broj blokova u mreži određuje
se u programu domaćina
Glavni koncepti kod GPGPU programa
https://www.coursera.org/course/hetero
Heterogeneous Parallel Programming
https://www.udacity.com/course/cs344
Introduction to Parallel Programming
GPGPU MOOC-ovi
http://gpgpu.org/
http://www.gpucomputing.net/
https://developer.nvidia.com/
category/zone/cuda-zone
http://developer.amd.com/
resources/ heterogeneous-
computing/opencl-zone/
Web resursi
Preporučena literatura - CUDA
Preporučena literatura - OpenCL
Uvod u
GPGPU
programiranje
Elektronski fakultet Niš
16.04.2015.
dr Dušan Gajić
e-mail: dusan.b.gajic@gmail.com

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Uvod u GPGPU programiranje