SlideShare a Scribd company logo
GPU Computing for Data Science
John Joo
john.joo@dominodatalab.com
Data Science Evangelist @ Domino Data Lab
Outline
• Why use GPUs?
• Example applications in data science
• Programming your GPU
Case Study:
Monte Carlo Simulations
• Simulate behavior when randomness
is a key component
• Average the results of many
simulations
• Make predictions
Little Information in One “Noisy Simulation”
Price(t+1) = Price(t) e InterestRate•dt + noise
Many “Noisy Simulations” ➡ Actionable Information
Price(t+1) = Price(t) e InterestRate•dt + noise
Monte Carlo Simulations Are Often Slow
• Lots of simulation data is required to
create valid models
• Generating lots of data takes time
• CPU works sequentially
CPUs designed for sequential, complex tasks
Source: Mythbusters https://youtu.be/-P28LKWTzrI
GPUs designed for parallel, low level tasks
Source: Mythbusters https://youtu.be/-P28LKWTzrI
GPUs designed for parallel, low level tasks
Source: Mythbusters https://youtu.be/-P28LKWTzrI
Applications of GPU Computing in Data Science
• Matrix Manipulation
• Numerical Analysis
• Sorting
• FFT
• String matching
• Monte Carlo simulations
• Machine learning
• Search
Algorithms for GPU Acceleration
• Inherently parallel
• Matrix operations
• High FLoat-point Operations Per Sec
(FLOPS)
GPUs Make Deep Learning Accessible
Google
Datacenter
Stanford AI Lab
# of machines 1,000 3
# of CPUs or
GPUs
2,000 CPUs 12 GPUs
Cores 16,000 18,432
Power used 600 kW 4 kW
Cost $5,000,000 $33,000
Adam Coates, Brody Huval,Tao Wang, David Wu, Bryan Catanzaro, Ng Andrew ; JMLR W&CP 28 (3) : 1337–1345, 2013
CPU vs GPU Architecture:
Structured for Different Purposes
CPU
4-8 High Performance Cores
GPU
100s-1000s of bare bones cores
Both CPU and GPU are required
CPU GPU
Compute intensive
functions
Everything else
General Purpose GPU Computing (GPGPU)
Heterogeneous Computing
Getting Started: Hardware
• Need a computer with GPU
• GPU should not be operating your
display
Spin up a GPU/CPU computer with 1 click.
8 CPU cores, 15 GB RAM
1,536 GPU cores, 4GB RAM
Getting Started: Hardware
✔
Programming CPU
• Sequential
• Write code top to bottom
• Can do complex tasks
• Independent
Programming GPU
• Parallel
• Multi-threaded - race conditions
• Low level tasks
• Dependent on CPU
Getting Started: Software
Talking to your GPU
CUDA and OpenCL are GPU computing frameworks
Choosing How to Interface with GPU:
Simplicity vs Flexibility
Application
specific
libraries
General
purpose GPU
libraries
Custom
CUDA/
OpenCL code
Flexibility
Simplicity
Low
Low
High
High
Application Specific Libraries
Python
• Theano - Symbolic math
• TensorFlow - ML
• Lasagne - NN
• Pylearn2 - ML
• mxnet - NN
• ABSsysbio - Systems Bio
R
• cudaBayesreg - fMRI
• mxnet - NN
• rpud -SVM
• rgpu - bioinformatics
Tutorial on using Theano, Lasagne, and no-learn:
http://blog.dominodatalab.com/gpu-computing-and-deep-learning/
General Purpose GPU Libraries
• Python and R wrappers for basic matrix
and linear algebra operations
• scikit-cuda
• cudamat
• gputools
• HiPLARM
• Drop-in library
Drop-in Library
Credit: NVIDIA
Also works for Python!
http://scelementary.com/2015/04/09/nvidia-nvblas-in-numpy.html
Custom CUDA/OpenCL Code
1. Allocate memory on the GPU
2. Transfer data from CPU to GPU
3. Launch the kernel to operate on the CPU
cores
4. Transfer results back to CPU
Example of using Python and CUDA:
Monte Carlo Simulations
• Using PyCuda to interface Python and
CUDA
• Simulating 3 million paths, 100 time steps
each
Python Code for CPU
Python/PyCUDA Code for GPU
8 more lines of code
Python Code for CPU
Python/PyCUDA Code for CPU
1. Allocate memory on the GPU
Python Code for CPU
Python/PyCUDA Code for CPU
2. Transfer data from CPU to GPU
Python Code for CPU
Python/PyCUDA Code for CPU
3. Launch the kernel to operate on the CPU cores
Python Code for CPU
Python/PyCUDA Code for CPU
4. Transfer results back to CPU
Python Code for CPU
26 sec
Python/PyCUDA Code for CPU
8 more lines of code
1.5 sec
17x speed up
Some sample Jupyter notebooks
• https://app.dominodatalab.com/johnjoo/gpu_examples
• Monte Carlo example using PyCUDA
• PyCUDA example compiling CUDA C for kernel
instructions
• Scikit-cuda example of matrix multiplication
• Calculating a distance matrix using rpud
More resources
• NVIDIA
• https://developer.nvidia.com/how-to-cuda-python
• Berkeley GPU workshop
• http://www.stat.berkeley.edu/scf/paciorek-
gpuWorkshop.html
• Duke Statistics on GPU (Python)
• http://people.duke.edu/~ccc14/sta-663/
CUDAPython.html
• Andreas Klockner’s webpage (Python)
• http://mathema.tician.de/
• Summary of GPU libraries
• http://fastml.com/running-things-on-a-gpu/
More resources
• Walk through of CUDA programming in R
• http://blog.revolutionanalytics.com/2015/01/parallel-
programming-with-gpus-and-r.html
• List of libraries for GPU computing in R
• https://cran.r-project.org/web/views/
HighPerformanceComputing.html
• Matrix computations in Machine Learning
• http://numml.kyb.tuebingen.mpg.de/numl09/
talk_dhillon.pdf
Questions?
john.joo@dominodatalab.com
blog.dominodatalab.com
john.joo@dominodatalab.com
blog.dominodatalab.com

More Related Content

What's hot (20)

PDF
Chat GPT Intoduction.pdf
Thiyagu K
 
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
PDF
What Are the Problems Associated with ChatGPT?
Windzoon Technologies
 
DOCX
What is chat gpt advance guide.docx
Versionsol
 
PDF
AI生成工具的新衝擊 - MS Bing & Google Bard 能否挑戰ChatGPT-4領導地位
eLearning Consortium 電子學習聯盟
 
PDF
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
PDF
Booz Allen Field Guide to Data Science
Booz Allen Hamilton
 
PPTX
Introduction to ChatGPT
Damian T. Gordon
 
PDF
ChatGPT SEO Guide 2023
Web Trainings Academy
 
PDF
Build Features, Not Apps
Natasha Murashev
 
PDF
ChatGPT-the-revolution-is-coming.pdf
Liang Yan
 
PDF
Generative AI: Redefining Creativity and Transforming Corporate Landscape
Osaka University
 
PPTX
Generative AI Risks & Concerns
Ajitesh Kumar
 
PDF
Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74)
Naoki (Neo) SATO
 
PDF
Introduction to ChatGPT and Overview of its capabilities and functionality.pdf
AD Techlogix - Website & Mobile App Development Company
 
PDF
10 Key Considerations for AI/ML Model Governance
QuantUniversity
 
PPTX
The Future of AI is Generative not Discriminative 5/26/2021
Steve Omohundro
 
PDF
GENERATIVE AI, THE FUTURE OF PRODUCTIVITY
Andre Muscat
 
PPTX
OpenAI-Copilot-ChatGPT.pptx
Udaiappa Ramachandran
 
PDF
ChatGPT Guide.pdf
ssuser0dac02
 
Chat GPT Intoduction.pdf
Thiyagu K
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
What Are the Problems Associated with ChatGPT?
Windzoon Technologies
 
What is chat gpt advance guide.docx
Versionsol
 
AI生成工具的新衝擊 - MS Bing & Google Bard 能否挑戰ChatGPT-4領導地位
eLearning Consortium 電子學習聯盟
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Booz Allen Field Guide to Data Science
Booz Allen Hamilton
 
Introduction to ChatGPT
Damian T. Gordon
 
ChatGPT SEO Guide 2023
Web Trainings Academy
 
Build Features, Not Apps
Natasha Murashev
 
ChatGPT-the-revolution-is-coming.pdf
Liang Yan
 
Generative AI: Redefining Creativity and Transforming Corporate Landscape
Osaka University
 
Generative AI Risks & Concerns
Ajitesh Kumar
 
Microsoft + OpenAI: Recent Updates (Machine Learning 15minutes! Broadcast #74)
Naoki (Neo) SATO
 
Introduction to ChatGPT and Overview of its capabilities and functionality.pdf
AD Techlogix - Website & Mobile App Development Company
 
10 Key Considerations for AI/ML Model Governance
QuantUniversity
 
The Future of AI is Generative not Discriminative 5/26/2021
Steve Omohundro
 
GENERATIVE AI, THE FUTURE OF PRODUCTIVITY
Andre Muscat
 
OpenAI-Copilot-ChatGPT.pptx
Udaiappa Ramachandran
 
ChatGPT Guide.pdf
ssuser0dac02
 

Viewers also liked (19)

PDF
DAMA Webinar - Big and Little Data Quality
DATAVERSITY
 
PDF
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
ryanorban
 
PDF
Analytics Trends 2016: The next evolution
Deloitte United States
 
PDF
Empowering developers to deploy their own data stores
Tomas Doran
 
PDF
Net Promoter Score Pitfalls to Avoid
Aureus Analytics
 
PDF
Pollen VC Building A Digital Lending Business
Pollen VC
 
PDF
Ways of Seeing Data: Towards a Critical Literacy for Data Visualisations as R...
Jonathan Gray
 
PDF
Visualising Data with Code
Ri Liu
 
PPTX
Data made out of functions
kenbot
 
PDF
GAME ON! Integrating Games and Simulations in the Classroom
Brian Housand
 
PPTX
What to Upload to SlideShare
SlideShare
 
PDF
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
PDF
Dear NSA, let me take care of your slides.
Emiland
 
PPTX
IT in Healthcare
NetApp
 
PDF
African Americans: College Majors and Earnings
CEW Georgetown
 
PDF
SXSW 2016: The Need To Knows
Ogilvy Consulting
 
PDF
Creative Traction Methodology - For Early Stage Startups
Tommaso Di Bartolo
 
PDF
Mobile Is Eating the World (2016)
a16z
 
PDF
The Physical Interface
Josh Clark
 
DAMA Webinar - Big and Little Data Quality
DATAVERSITY
 
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
ryanorban
 
Analytics Trends 2016: The next evolution
Deloitte United States
 
Empowering developers to deploy their own data stores
Tomas Doran
 
Net Promoter Score Pitfalls to Avoid
Aureus Analytics
 
Pollen VC Building A Digital Lending Business
Pollen VC
 
Ways of Seeing Data: Towards a Critical Literacy for Data Visualisations as R...
Jonathan Gray
 
Visualising Data with Code
Ri Liu
 
Data made out of functions
kenbot
 
GAME ON! Integrating Games and Simulations in the Classroom
Brian Housand
 
What to Upload to SlideShare
SlideShare
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
Dear NSA, let me take care of your slides.
Emiland
 
IT in Healthcare
NetApp
 
African Americans: College Majors and Earnings
CEW Georgetown
 
SXSW 2016: The Need To Knows
Ogilvy Consulting
 
Creative Traction Methodology - For Early Stage Startups
Tommaso Di Bartolo
 
Mobile Is Eating the World (2016)
a16z
 
The Physical Interface
Josh Clark
 
Ad

Similar to GPU Computing for Data Science (20)

PDF
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
Edge AI and Vision Alliance
 
PDF
GPU Computing With Apache Spark And Python
Jen Aman
 
PDF
The Rise of Parallel Computing
bakers84
 
PPT
Current Trends in HPC
Putchong Uthayopas
 
PDF
Pgopencl
Tim Child
 
PDF
PostgreSQL with OpenCL
Muhaza Liebenlito
 
PPTX
GPU in Computer Science advance topic .pptx
HamzaAli998966
 
PDF
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Anne Nicolas
 
PPTX
GPU and Deep learning best practices
Lior Sidi
 
PDF
Programming Models for Heterogeneous Chips
Facultad de Informática UCM
 
PDF
OpenCL & the Future of Desktop High Performance Computing in CAD
Design World
 
PDF
GPU enablement for data science on OpenShift | DevNation Tech Talk
Red Hat Developers
 
PPTX
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
Rogue Wave Software
 
PDF
The GPGPU Continuum
Ofer Rosenberg
 
PPTX
Stream Processing
arnamoy10
 
PPTX
Introduction to DPDK
Kernel TLV
 
PPT
NVidia CUDA for Bruteforce Attacks - DefCamp 2012
DefCamp
 
PDF
GPU databases - How to use them and what the future holds
Arnon Shimoni
 
PDF
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
Ganesan Narayanasamy
 
PDF
OpenPOWER Acceleration of HPCC Systems
HPCC Systems
 
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
Edge AI and Vision Alliance
 
GPU Computing With Apache Spark And Python
Jen Aman
 
The Rise of Parallel Computing
bakers84
 
Current Trends in HPC
Putchong Uthayopas
 
Pgopencl
Tim Child
 
PostgreSQL with OpenCL
Muhaza Liebenlito
 
GPU in Computer Science advance topic .pptx
HamzaAli998966
 
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
Anne Nicolas
 
GPU and Deep learning best practices
Lior Sidi
 
Programming Models for Heterogeneous Chips
Facultad de Informática UCM
 
OpenCL & the Future of Desktop High Performance Computing in CAD
Design World
 
GPU enablement for data science on OpenShift | DevNation Tech Talk
Red Hat Developers
 
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
Rogue Wave Software
 
The GPGPU Continuum
Ofer Rosenberg
 
Stream Processing
arnamoy10
 
Introduction to DPDK
Kernel TLV
 
NVidia CUDA for Bruteforce Attacks - DefCamp 2012
DefCamp
 
GPU databases - How to use them and what the future holds
Arnon Shimoni
 
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
Ganesan Narayanasamy
 
OpenPOWER Acceleration of HPCC Systems
HPCC Systems
 
Ad

More from Domino Data Lab (20)

PDF
What's in your workflow? Bringing data science workflows to business analysis...
Domino Data Lab
 
PDF
The Proliferation of New Database Technologies and Implications for Data Scie...
Domino Data Lab
 
PDF
Racial Bias in Policing: an analysis of Illinois traffic stops data
Domino Data Lab
 
PPTX
Data Quality Analytics: Understanding what is in your data, before using it
Domino Data Lab
 
PPTX
Supporting innovation in insurance with randomized experimentation
Domino Data Lab
 
PPTX
Leveraging Data Science in the Automotive Industry
Domino Data Lab
 
PDF
Summertime Analytics: Predicting E. coli and West Nile Virus
Domino Data Lab
 
PPTX
Reproducible Dashboards and other great things to do with Jupyter
Domino Data Lab
 
PDF
GeoViz: A Canvas for Data Science
Domino Data Lab
 
PPTX
Managing Data Science | Lessons from the Field
Domino Data Lab
 
PDF
Doing your first Kaggle (Python for Big Data sets)
Domino Data Lab
 
PDF
Leveraged Analytics at Scale
Domino Data Lab
 
PDF
How I Learned to Stop Worrying and Love Linked Data
Domino Data Lab
 
PDF
Software Engineering for Data Scientists
Domino Data Lab
 
PDF
Making Big Data Smart
Domino Data Lab
 
PPTX
Moving Data Science from an Event to A Program: Considerations in Creating Su...
Domino Data Lab
 
PPTX
Building Data Analytics pipelines in the cloud using serverless technology
Domino Data Lab
 
PPTX
Leveraging Open Source Automated Data Science Tools
Domino Data Lab
 
PPTX
Domino and AWS: collaborative analytics and model governance at financial ser...
Domino Data Lab
 
PDF
The Role and Importance of Curiosity in Data Science
Domino Data Lab
 
What's in your workflow? Bringing data science workflows to business analysis...
Domino Data Lab
 
The Proliferation of New Database Technologies and Implications for Data Scie...
Domino Data Lab
 
Racial Bias in Policing: an analysis of Illinois traffic stops data
Domino Data Lab
 
Data Quality Analytics: Understanding what is in your data, before using it
Domino Data Lab
 
Supporting innovation in insurance with randomized experimentation
Domino Data Lab
 
Leveraging Data Science in the Automotive Industry
Domino Data Lab
 
Summertime Analytics: Predicting E. coli and West Nile Virus
Domino Data Lab
 
Reproducible Dashboards and other great things to do with Jupyter
Domino Data Lab
 
GeoViz: A Canvas for Data Science
Domino Data Lab
 
Managing Data Science | Lessons from the Field
Domino Data Lab
 
Doing your first Kaggle (Python for Big Data sets)
Domino Data Lab
 
Leveraged Analytics at Scale
Domino Data Lab
 
How I Learned to Stop Worrying and Love Linked Data
Domino Data Lab
 
Software Engineering for Data Scientists
Domino Data Lab
 
Making Big Data Smart
Domino Data Lab
 
Moving Data Science from an Event to A Program: Considerations in Creating Su...
Domino Data Lab
 
Building Data Analytics pipelines in the cloud using serverless technology
Domino Data Lab
 
Leveraging Open Source Automated Data Science Tools
Domino Data Lab
 
Domino and AWS: collaborative analytics and model governance at financial ser...
Domino Data Lab
 
The Role and Importance of Curiosity in Data Science
Domino Data Lab
 

Recently uploaded (20)

PPTX
Comparative Study of ML Techniques for RealTime Credit Card Fraud Detection S...
Debolina Ghosh
 
PPTX
thid ppt defines the ich guridlens and gives the information about the ICH gu...
shaistabegum14
 
PDF
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PPTX
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
PDF
Research Methodology Overview Introduction
ayeshagul29594
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PDF
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
PDF
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
PDF
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
PDF
Unlocking Insights: Introducing i-Metrics Asia-Pacific Corporation and Strate...
Janette Toral
 
PPTX
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
PDF
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
PPTX
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
PPTX
What Is Data Integration and Transformation?
subhashenia
 
PDF
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
PPTX
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
PDF
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
PDF
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
PDF
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
Comparative Study of ML Techniques for RealTime Credit Card Fraud Detection S...
Debolina Ghosh
 
thid ppt defines the ich guridlens and gives the information about the ICH gu...
shaistabegum14
 
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
Research Methodology Overview Introduction
ayeshagul29594
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
Unlocking Insights: Introducing i-Metrics Asia-Pacific Corporation and Strate...
Janette Toral
 
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
apidays Singapore 2025 - Streaming Lakehouse with Kafka, Flink and Iceberg by...
apidays
 
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
What Is Data Integration and Transformation?
subhashenia
 
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 

GPU Computing for Data Science

  • 1. GPU Computing for Data Science John Joo [email protected] Data Science Evangelist @ Domino Data Lab
  • 2. Outline • Why use GPUs? • Example applications in data science • Programming your GPU
  • 3. Case Study: Monte Carlo Simulations • Simulate behavior when randomness is a key component • Average the results of many simulations • Make predictions
  • 4. Little Information in One “Noisy Simulation” Price(t+1) = Price(t) e InterestRate•dt + noise
  • 5. Many “Noisy Simulations” ➡ Actionable Information Price(t+1) = Price(t) e InterestRate•dt + noise
  • 6. Monte Carlo Simulations Are Often Slow • Lots of simulation data is required to create valid models • Generating lots of data takes time • CPU works sequentially
  • 7. CPUs designed for sequential, complex tasks Source: Mythbusters https://youtu.be/-P28LKWTzrI
  • 8. GPUs designed for parallel, low level tasks Source: Mythbusters https://youtu.be/-P28LKWTzrI
  • 9. GPUs designed for parallel, low level tasks Source: Mythbusters https://youtu.be/-P28LKWTzrI
  • 10. Applications of GPU Computing in Data Science • Matrix Manipulation • Numerical Analysis • Sorting • FFT • String matching • Monte Carlo simulations • Machine learning • Search Algorithms for GPU Acceleration • Inherently parallel • Matrix operations • High FLoat-point Operations Per Sec (FLOPS)
  • 11. GPUs Make Deep Learning Accessible Google Datacenter Stanford AI Lab # of machines 1,000 3 # of CPUs or GPUs 2,000 CPUs 12 GPUs Cores 16,000 18,432 Power used 600 kW 4 kW Cost $5,000,000 $33,000 Adam Coates, Brody Huval,Tao Wang, David Wu, Bryan Catanzaro, Ng Andrew ; JMLR W&CP 28 (3) : 1337–1345, 2013
  • 12. CPU vs GPU Architecture: Structured for Different Purposes CPU 4-8 High Performance Cores GPU 100s-1000s of bare bones cores
  • 13. Both CPU and GPU are required CPU GPU Compute intensive functions Everything else General Purpose GPU Computing (GPGPU) Heterogeneous Computing
  • 14. Getting Started: Hardware • Need a computer with GPU • GPU should not be operating your display Spin up a GPU/CPU computer with 1 click. 8 CPU cores, 15 GB RAM 1,536 GPU cores, 4GB RAM
  • 16. Programming CPU • Sequential • Write code top to bottom • Can do complex tasks • Independent Programming GPU • Parallel • Multi-threaded - race conditions • Low level tasks • Dependent on CPU Getting Started: Software
  • 17. Talking to your GPU CUDA and OpenCL are GPU computing frameworks
  • 18. Choosing How to Interface with GPU: Simplicity vs Flexibility Application specific libraries General purpose GPU libraries Custom CUDA/ OpenCL code Flexibility Simplicity Low Low High High
  • 19. Application Specific Libraries Python • Theano - Symbolic math • TensorFlow - ML • Lasagne - NN • Pylearn2 - ML • mxnet - NN • ABSsysbio - Systems Bio R • cudaBayesreg - fMRI • mxnet - NN • rpud -SVM • rgpu - bioinformatics Tutorial on using Theano, Lasagne, and no-learn: http://blog.dominodatalab.com/gpu-computing-and-deep-learning/
  • 20. General Purpose GPU Libraries • Python and R wrappers for basic matrix and linear algebra operations • scikit-cuda • cudamat • gputools • HiPLARM • Drop-in library
  • 21. Drop-in Library Credit: NVIDIA Also works for Python! http://scelementary.com/2015/04/09/nvidia-nvblas-in-numpy.html
  • 22. Custom CUDA/OpenCL Code 1. Allocate memory on the GPU 2. Transfer data from CPU to GPU 3. Launch the kernel to operate on the CPU cores 4. Transfer results back to CPU
  • 23. Example of using Python and CUDA: Monte Carlo Simulations • Using PyCuda to interface Python and CUDA • Simulating 3 million paths, 100 time steps each
  • 24. Python Code for CPU Python/PyCUDA Code for GPU 8 more lines of code
  • 25. Python Code for CPU Python/PyCUDA Code for CPU 1. Allocate memory on the GPU
  • 26. Python Code for CPU Python/PyCUDA Code for CPU 2. Transfer data from CPU to GPU
  • 27. Python Code for CPU Python/PyCUDA Code for CPU 3. Launch the kernel to operate on the CPU cores
  • 28. Python Code for CPU Python/PyCUDA Code for CPU 4. Transfer results back to CPU
  • 29. Python Code for CPU 26 sec Python/PyCUDA Code for CPU 8 more lines of code 1.5 sec 17x speed up
  • 30. Some sample Jupyter notebooks • https://app.dominodatalab.com/johnjoo/gpu_examples • Monte Carlo example using PyCUDA • PyCUDA example compiling CUDA C for kernel instructions • Scikit-cuda example of matrix multiplication • Calculating a distance matrix using rpud
  • 31. More resources • NVIDIA • https://developer.nvidia.com/how-to-cuda-python • Berkeley GPU workshop • http://www.stat.berkeley.edu/scf/paciorek- gpuWorkshop.html • Duke Statistics on GPU (Python) • http://people.duke.edu/~ccc14/sta-663/ CUDAPython.html • Andreas Klockner’s webpage (Python) • http://mathema.tician.de/ • Summary of GPU libraries • http://fastml.com/running-things-on-a-gpu/
  • 32. More resources • Walk through of CUDA programming in R • http://blog.revolutionanalytics.com/2015/01/parallel- programming-with-gpus-and-r.html • List of libraries for GPU computing in R • https://cran.r-project.org/web/views/ HighPerformanceComputing.html • Matrix computations in Machine Learning • http://numml.kyb.tuebingen.mpg.de/numl09/ talk_dhillon.pdf