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

PDF
Digital Transformation Strategy Template and Training
PDF
High Tech Digital Transformation
PDF
Digital Business Transformation | Strategy + Execution
PPT
Digital Transformation Templates.ppt
PDF
14 2 2023 - AI & Marketing - Hugues Rey.pdf
PPTX
[Accenture] Digital Business 2017
PPTX
Apache Hadoop Summit 2016: The Future of Apache Hadoop an Enterprise Architec...
PPTX
How fit is your capital allocation strategy?
 
Digital Transformation Strategy Template and Training
High Tech Digital Transformation
Digital Business Transformation | Strategy + Execution
Digital Transformation Templates.ppt
14 2 2023 - AI & Marketing - Hugues Rey.pdf
[Accenture] Digital Business 2017
Apache Hadoop Summit 2016: The Future of Apache Hadoop an Enterprise Architec...
How fit is your capital allocation strategy?
 

What's hot (20)

PPTX
Reinventing Enterprise Operations
PDF
The Rapidly Evolving Landscape of Meal Kits and E-commerce in Food & Beverage
PDF
Accelerating hybrid-cloud adoption in banking and securities
PDF
Fintech New York: Partnerships, Platforms and Open Innovation
PDF
Accelerate Revenue with a Customer Data Platform
PDF
Digital Transformation Strategy PowerPoint Presentation Slides
PDF
Consumer privacy in retail
PPTX
SEOmoz Pitch Deck July 2011
PDF
#BainWebinar Next Generation Industrial Performance Post COVID-19
PDF
EY Germany FinTech Landscape
 
PDF
A Framework for Navigating Generative Artificial Intelligence for Enterprise
PPTX
Pursuing Customer Inspired Growth
PDF
What's Next: Digital Transformation
PDF
Digital Transformation
PDF
Dropbox: $15K VC investment turned into $16.8B. Dropbox's initial pitch deck
PPTX
Digital Business - Accenture
PPTX
Change! Digital Transformation
PDF
Linkedin Series B Pitch Deck
PDF
Tech Adoption and Strategy for Innovation & Growth
PPTX
Five building blocks of digital transformation
Reinventing Enterprise Operations
The Rapidly Evolving Landscape of Meal Kits and E-commerce in Food & Beverage
Accelerating hybrid-cloud adoption in banking and securities
Fintech New York: Partnerships, Platforms and Open Innovation
Accelerate Revenue with a Customer Data Platform
Digital Transformation Strategy PowerPoint Presentation Slides
Consumer privacy in retail
SEOmoz Pitch Deck July 2011
#BainWebinar Next Generation Industrial Performance Post COVID-19
EY Germany FinTech Landscape
 
A Framework for Navigating Generative Artificial Intelligence for Enterprise
Pursuing Customer Inspired Growth
What's Next: Digital Transformation
Digital Transformation
Dropbox: $15K VC investment turned into $16.8B. Dropbox's initial pitch deck
Digital Business - Accenture
Change! Digital Transformation
Linkedin Series B Pitch Deck
Tech Adoption and Strategy for Innovation & Growth
Five building blocks of digital transformation
Ad

Viewers also liked (20)

PDF
DAMA Webinar - Big and Little Data Quality
PDF
Booz Allen Field Guide to Data Science
PDF
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
PDF
Working With Big Data
PDF
Analytics Trends 2016: The next evolution
PDF
Empowering developers to deploy their own data stores
PDF
Net Promoter Score Pitfalls to Avoid
PDF
Pollen VC Building A Digital Lending Business
PDF
Ways of Seeing Data: Towards a Critical Literacy for Data Visualisations as R...
PDF
Visualising Data with Code
PPTX
Data made out of functions
PDF
GAME ON! Integrating Games and Simulations in the Classroom
PPTX
What to Upload to SlideShare
PDF
Mobile-First SEO - The Marketers Edition #3XEDigital
PDF
Dear NSA, let me take care of your slides.
PPTX
IT in Healthcare
PDF
African Americans: College Majors and Earnings
PDF
SXSW 2016: The Need To Knows
PDF
Creative Traction Methodology - For Early Stage Startups
PDF
Mobile Is Eating the World (2016)
DAMA Webinar - Big and Little Data Quality
Booz Allen Field Guide to Data Science
Bridging the Gap Between Data Science & Engineer: Building High-Performance T...
Working With Big Data
Analytics Trends 2016: The next evolution
Empowering developers to deploy their own data stores
Net Promoter Score Pitfalls to Avoid
Pollen VC Building A Digital Lending Business
Ways of Seeing Data: Towards a Critical Literacy for Data Visualisations as R...
Visualising Data with Code
Data made out of functions
GAME ON! Integrating Games and Simulations in the Classroom
What to Upload to SlideShare
Mobile-First SEO - The Marketers Edition #3XEDigital
Dear NSA, let me take care of your slides.
IT in Healthcare
African Americans: College Majors and Earnings
SXSW 2016: The Need To Knows
Creative Traction Methodology - For Early Stage Startups
Mobile Is Eating the World (2016)
Ad

Similar to GPU Computing for Data Science (20)

PDF
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
PDF
GPU Computing With Apache Spark And Python
PDF
The Rise of Parallel Computing
PPT
Current Trends in HPC
PDF
Pgopencl
PDF
PostgreSQL with OpenCL
PPTX
GPU in Computer Science advance topic .pptx
PDF
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
PPTX
GPU and Deep learning best practices
PDF
Programming Models for Heterogeneous Chips
PDF
OpenCL & the Future of Desktop High Performance Computing in CAD
PDF
GPU enablement for data science on OpenShift | DevNation Tech Talk
PPTX
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
PDF
The GPGPU Continuum
PPTX
Stream Processing
PPTX
Introduction to DPDK
PPT
NVidia CUDA for Bruteforce Attacks - DefCamp 2012
PDF
GPU databases - How to use them and what the future holds
PDF
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
PDF
OpenPOWER Acceleration of HPCC Systems
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
GPU Computing With Apache Spark And Python
The Rise of Parallel Computing
Current Trends in HPC
Pgopencl
PostgreSQL with OpenCL
GPU in Computer Science advance topic .pptx
Kernel Recipes 2016 - Speeding up development by setting up a kernel build farm
GPU and Deep learning best practices
Programming Models for Heterogeneous Chips
OpenCL & the Future of Desktop High Performance Computing in CAD
GPU enablement for data science on OpenShift | DevNation Tech Talk
Debugging Numerical Simulations on Accelerated Architectures - TotalView fo...
The GPGPU Continuum
Stream Processing
Introduction to DPDK
NVidia CUDA for Bruteforce Attacks - DefCamp 2012
GPU databases - How to use them and what the future holds
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
OpenPOWER Acceleration of HPCC Systems

More from Domino Data Lab (20)

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

Recently uploaded (20)

PPTX
IB Computer Science - Internal Assessment.pptx
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
PPTX
Supervised vs unsupervised machine learning algorithms
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Global journeys: estimating international migration
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
Clinical guidelines as a resource for EBP(1).pdf
PPT
Quality review (1)_presentation of this 21
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
Logistic Regression ml machine learning.pptx
PDF
Taxes Foundatisdcsdcsdon Certificate.pdf
PPTX
Moving the Public Sector (Government) to a Digital Adoption
IB Computer Science - Internal Assessment.pptx
Fluorescence-microscope_Botany_detailed content
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
Supervised vs unsupervised machine learning algorithms
Miokarditis (Inflamasi pada Otot Jantung)
Introduction to Knowledge Engineering Part 1
oil_refinery_comprehensive_20250804084928 (1).pptx
Global journeys: estimating international migration
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Clinical guidelines as a resource for EBP(1).pdf
Quality review (1)_presentation of this 21
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
Logistic Regression ml machine learning.pptx
Taxes Foundatisdcsdcsdon Certificate.pdf
Moving the Public Sector (Government) to a Digital Adoption

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