SlideShare a Scribd company logo
MPI Cluster
   Programming with
Python and Amazon EC2
      Pete Skomoroch

           datawrangling.com
           juiceanalytics.com/writing
Outline
Netflix Prize & Amazon EC2
Python Parallel Programming Options
ElasticWulf
MPI basics in Python
Demo: ElasticWulf, mpi4py, Ipython1
ElasticWulf Performance
EC2 pointers + Q&A
The Netflix Prize

                               17K movies
                               500K users
                               100M ratings
                               2 GB raw data

                               A “big” computation?




10% improvement of RMSE wins $1 Million
Crunching the data at home...

               Use the Pyflix library to squeeze dataset
               into 600 MB

               http://pyflix.python-hosting.com

               Simon Funk iterative SVD algorithm runs
               on your laptop overnight

               “Timely Development” code gets us to
               4% improvement over Cinematch

               Use Numpy/Scipy, call C when needed
I needed more CPUs

Basic algorithm ties up your machine for 13 hours
Some algorithms take weeks...
Need runs over many sets of parameters
Need to run cross validation over large datasets
Bugs in long jobs suck
The best approach so far ( Bell Labs ) merged the
successful results of over 107 different algorithms
But this was my only machine...
How can I get a Beowulf cluster?
Cluster of nearly identical commodity machines
Employ message passing model of parallel computation
Often have shared filesystem
Amazon EC2



                __init__(                               )


      Launch instances of Amazon Machine
      Images (AMIs) from your Python code

      Pay only for what you use (wall clock time)


http://www.flickr.com/photos/steverosebush/2241578490/
EC2 Instance Types

                         Small 1x   Large 4x   ExtraLarge 8x

        RAM               1.7GB      7.5GB        15GB

         Disk             160GB     850GB         1.6TB

  CPU (1.7Ghz)            1 32bit    4 64bit      8 64bit

        I/O
                         Moderate    High          High
   Performance
        Price             $0.10      $0.40        $0.80
   (per instance-hour)
Driving EC2 using Python

yum -y install python-boto

Blog post: “Amazon EC2 Basics for Python Programmers”
- James Gardner

PyCon talk: “Like Switching on the Light: Managing an
Elastic Compute Cluster with Python”
	 	 George Belotsky; Heath Johns

http://del.icio.us/pskomoroch/ec2
Parallel Programming in Python

 MapReduce (Hadoop + Python)
 Python MPI options (mpi4py, pyMPI, ...)
 Wrap existing C++/Fortran libs (ScaLAPACK,PETSc, ...)
 Pyro
 Twisted
 IPython1

 Which one you use depends on your particular situation

 These are not mutually exclusive or exhaustive...
Introducing ElasticWulf
ElasticWulf - batteries included
Master and worker beowulf node Amazon Machine Images
Python command line scripts to launch/configure cluster
Includes Ipython1 and other good stuff...

The AMIs are publicly visible
Updated python scripts + docs will be on Google Code

BLAS/LAPACK       OpenMPI      Xwindows      Twisted
 Numpy/Scipy       MPICH         NFS        Ipython1
   ipython        MPICH2        Ganglia      mpi4py
  matplotlib        LAM         C3 tools      boto
What is MPI?

High performance message passing interface (MPI)
Standard protocol implemented in multiple languages
Point to Point - Collective Operations
Very flexible, complex...
We will just look at a use case involving a master process
broadcasting data and receiving results from slave
processes via simple primitives (bcast(), scatter(), gather(),
reduce())
MPI Basics in Python

Lets look at some code...
size attribute: number of cooperating processes
rank attribute: unique identifier of a process



We will cover some PyMPI examples, but I would recommend using mpi4py (moved over
to scipy, used by Ipython1)

http://mpi4py.scipy.org/

The program structure is nearly identical in either implementation.
MPI Broadcast




mpi.bcast()

broadcasts a value from the root process to all other processes
MPI Scatter




mpi.scatter()

scatters an array roughly evenly across processes
MPI Gather




mpi.gather()

Collects results from all processes back to the master process
MPI Reduce




mpi.reduce()

Apply a summary function across all nodes. Like Python reduce (at
least until Guido kills it)
A simple example
  Calculating Pi.
  Throw random darts at a dartboard.
Monte Carlo Pi


 Measure the distance
 from the origin, count
 the number of “darts”
 that are within 1 unit of
 the origin, and the total
 number of darts...
Throwing more darts




42 inside the circle
8 outside the circle
estimated pi is 3.360 ( 42*4 / (42+8) )
Serial Pi Calculation
Throwing darts in parallel
Parallel Pi Calculation
Starting up your ElasticWulf Cluster


1) Sign up for Amazon Web Services
2) Get your keys/certificates + define environment variables
4) Download ElasticWulf Python scripts
4) Add your Amazon Id to the ElasticWulf config file
5) ./start-cluster.py -n 3 -s ‘xlarge’
6) ./ec2-mpi-config.py
7) ssh in to the master node...
Demo: Start the cluster
 $ ./ec2-start-cluster.py
Demo: check progress

$ ./ec2-check-instances.py
Demo: configure the nodes
   $ ./ec2-mpi-config.py
Demo: login to the master node
Demo: start the MPI daemons
Demo: mpi4py code
Demo: run mpi4py code
Running Ganglia
Demo: start ipython1 controller
Demo: start engines with mpirun
Demo: parallel ipython1
Demo: parallel ipython1
Scaling KNN on ElasticWulf
Run pearson correlation between every pair of movies...
Use Numpy & mpi4py to scatter the movie ratings vectors
Spend $2.40 for 24 cpu hours, trade $ for time
Performance
Latency: 0.000492 (microseconds)




   Netpipe Benchmark
EC2 “gotchas”

EC2 is still in Beta: instances die, freeze, be prepared
Relatively high latency
Dynamic subnet
ec2-upload-bundle --retry
/etc/fstab overwritten by default in bundle-vol
more: http://del.icio.us/pskomoroch/ec2+gotchas
Questions?

More Related Content

What's hot

Storm presentation
Storm presentationStorm presentation
Storm presentation
Shyam Raj
 
Introduction to Apache Storm - Concept & Example
Introduction to Apache Storm - Concept & ExampleIntroduction to Apache Storm - Concept & Example
Introduction to Apache Storm - Concept & Example
Dung Ngua
 
Paris DataGeek - SummingBird
Paris DataGeek - SummingBirdParis DataGeek - SummingBird
Paris DataGeek - SummingBird
Sofian Djamaa
 
Custom object detection_gcp
Custom object detection_gcpCustom object detection_gcp
Custom object detection_gcp
Vaibhav Sahu
 
Apache spark presentation
Apache spark presentationApache spark presentation
Apache spark presentation
Mahboob Hussain
 
Luigi presentation NYC Data Science
Luigi presentation NYC Data ScienceLuigi presentation NYC Data Science
Luigi presentation NYC Data Science
Erik Bernhardsson
 
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
Amazon Web Services
 
SciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with NumbaSciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with Numba
stan_seibert
 
Pytorch Ecosystem Day: The 珞 Ecosystem
Pytorch Ecosystem Day: The 珞 EcosystemPytorch Ecosystem Day: The 珞 Ecosystem
Pytorch Ecosystem Day: The 珞 Ecosystem
Lysandre Debut
 
Apache Storm Internals
Apache Storm InternalsApache Storm Internals
Apache Storm Internals
Humoyun Ahmedov
 
Tensorflow vs MxNet
Tensorflow vs MxNetTensorflow vs MxNet
Tensorflow vs MxNet
Ashish Bansal
 
Luigi future
Luigi futureLuigi future
Luigi future
Erik Bernhardsson
 
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona DashboardsMonitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
Julien Pivotto
 
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow management
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow managementIntro to Airflow: Goodbye Cron, Welcome scheduled workflow management
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow management
Burasakorn Sabyeying
 
Slide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache StormSlide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache Storm
Md. Shamsur Rahim
 
Luigi presentation OA Summit
Luigi presentation OA SummitLuigi presentation OA Summit
Luigi presentation OA Summit
Open Analytics
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
Anton Babenko
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
Julien Corioland
 
Community-Driven Graphs with JanusGraph
Community-Driven Graphs with JanusGraphCommunity-Driven Graphs with JanusGraph
Community-Driven Graphs with JanusGraph
Jason Plurad
 
Managing data workflows with Luigi
Managing data workflows with LuigiManaging data workflows with Luigi
Managing data workflows with Luigi
Teemu Kurppa
 

What's hot (20)

Storm presentation
Storm presentationStorm presentation
Storm presentation
 
Introduction to Apache Storm - Concept & Example
Introduction to Apache Storm - Concept & ExampleIntroduction to Apache Storm - Concept & Example
Introduction to Apache Storm - Concept & Example
 
Paris DataGeek - SummingBird
Paris DataGeek - SummingBirdParis DataGeek - SummingBird
Paris DataGeek - SummingBird
 
Custom object detection_gcp
Custom object detection_gcpCustom object detection_gcp
Custom object detection_gcp
 
Apache spark presentation
Apache spark presentationApache spark presentation
Apache spark presentation
 
Luigi presentation NYC Data Science
Luigi presentation NYC Data ScienceLuigi presentation NYC Data Science
Luigi presentation NYC Data Science
 
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
 
SciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with NumbaSciPy 2019: How to Accelerate an Existing Codebase with Numba
SciPy 2019: How to Accelerate an Existing Codebase with Numba
 
Pytorch Ecosystem Day: The 珞 Ecosystem
Pytorch Ecosystem Day: The 珞 EcosystemPytorch Ecosystem Day: The 珞 Ecosystem
Pytorch Ecosystem Day: The 珞 Ecosystem
 
Apache Storm Internals
Apache Storm InternalsApache Storm Internals
Apache Storm Internals
 
Tensorflow vs MxNet
Tensorflow vs MxNetTensorflow vs MxNet
Tensorflow vs MxNet
 
Luigi future
Luigi futureLuigi future
Luigi future
 
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona DashboardsMonitoring MySQL with Prometheus, Grafana and Percona Dashboards
Monitoring MySQL with Prometheus, Grafana and Percona Dashboards
 
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow management
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow managementIntro to Airflow: Goodbye Cron, Welcome scheduled workflow management
Intro to Airflow: Goodbye Cron, Welcome scheduled workflow management
 
Slide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache StormSlide #1:Introduction to Apache Storm
Slide #1:Introduction to Apache Storm
 
Luigi presentation OA Summit
Luigi presentation OA SummitLuigi presentation OA Summit
Luigi presentation OA Summit
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Community-Driven Graphs with JanusGraph
Community-Driven Graphs with JanusGraphCommunity-Driven Graphs with JanusGraph
Community-Driven Graphs with JanusGraph
 
Managing data workflows with Luigi
Managing data workflows with LuigiManaging data workflows with Luigi
Managing data workflows with Luigi
 

Similar to Elasticwulf Pycon Talk

Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
Henry Schreiner
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
Ian Ozsvald
 
Deep learning with kafka
Deep learning with kafkaDeep learning with kafka
Deep learning with kafka
Nitin Kumar
 
Parallelism in a NumPy-based program
Parallelism in a NumPy-based programParallelism in a NumPy-based program
Parallelism in a NumPy-based program
Ralf Gommers
 
Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
jduart
 
PyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanPyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_Ayan
Ayan Pahwa
 
Multicore
MulticoreMulticore
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
Travis Oliphant
 
GoSF Jan 2016 - Go Write a Plugin for Snap!
GoSF Jan 2016 - Go Write a Plugin for Snap!GoSF Jan 2016 - Go Write a Plugin for Snap!
GoSF Jan 2016 - Go Write a Plugin for Snap!
Matthew Broberg
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
Sparkly Notebook: Interactive Analysis and Visualization with Spark
Sparkly Notebook: Interactive Analysis and Visualization with SparkSparkly Notebook: Interactive Analysis and Visualization with Spark
Sparkly Notebook: Interactive Analysis and Visualization with Spark
felixcss
 
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
Preferred Networks
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-optJeff Larkin
 
Leveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSLeveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWS
Amazon Web Services
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance Performance
Amazon Web Services
 

Similar to Elasticwulf Pycon Talk (20)

Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
Deep learning with kafka
Deep learning with kafkaDeep learning with kafka
Deep learning with kafka
 
Parallelism in a NumPy-based program
Parallelism in a NumPy-based programParallelism in a NumPy-based program
Parallelism in a NumPy-based program
 
Packer Genetics: The selfish code
Packer Genetics: The selfish codePacker Genetics: The selfish code
Packer Genetics: The selfish code
 
Docker meetup
Docker meetupDocker meetup
Docker meetup
 
PyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_AyanPyCon_India_2017_MicroPython_Ayan
PyCon_India_2017_MicroPython_Ayan
 
Multicore
MulticoreMulticore
Multicore
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
 
mpi4py.pdf
mpi4py.pdfmpi4py.pdf
mpi4py.pdf
 
GoSF Jan 2016 - Go Write a Plugin for Snap!
GoSF Jan 2016 - Go Write a Plugin for Snap!GoSF Jan 2016 - Go Write a Plugin for Snap!
GoSF Jan 2016 - Go Write a Plugin for Snap!
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
Sparkly Notebook: Interactive Analysis and Visualization with Spark
Sparkly Notebook: Interactive Analysis and Visualization with SparkSparkly Notebook: Interactive Analysis and Visualization with Spark
Sparkly Notebook: Interactive Analysis and Visualization with Spark
 
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-opt
 
Cloud Talk
Cloud TalkCloud Talk
Cloud Talk
 
Leveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSLeveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWS
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Deep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance PerformanceDeep Dive on Delivering Amazon EC2 Instance Performance
Deep Dive on Delivering Amazon EC2 Instance Performance
 

More from Peter Skomoroch

Bridging the AI Gap: Building Stakeholder Support
Bridging the AI Gap: Building Stakeholder SupportBridging the AI Gap: Building Stakeholder Support
Bridging the AI Gap: Building Stakeholder Support
Peter Skomoroch
 
Managing Machines: The New AI Dev Stack
Managing Machines: The New AI Dev StackManaging Machines: The New AI Dev Stack
Managing Machines: The New AI Dev Stack
Peter Skomoroch
 
Product Management for AI
Product Management for AIProduct Management for AI
Product Management for AI
Peter Skomoroch
 
Executive Briefing: Why managing machines is harder than you think
Executive Briefing: Why managing machines is harder than you thinkExecutive Briefing: Why managing machines is harder than you think
Executive Briefing: Why managing machines is harder than you think
Peter Skomoroch
 
Building Competitive Moats With Data
Building Competitive Moats With DataBuilding Competitive Moats With Data
Building Competitive Moats With Data
Peter Skomoroch
 
O'Reilly Strata: Distilling Data Exhaust
O'Reilly Strata: Distilling Data ExhaustO'Reilly Strata: Distilling Data Exhaust
O'Reilly Strata: Distilling Data Exhaust
Peter Skomoroch
 
SF Data Science: Developing Data Products
SF Data Science: Developing Data ProductsSF Data Science: Developing Data Products
SF Data Science: Developing Data Products
Peter Skomoroch
 
Skills, Reputation, and Search
Skills, Reputation, and SearchSkills, Reputation, and Search
Skills, Reputation, and Search
Peter Skomoroch
 
LinkedIn Endorsements: Reputation, Virality, and Social Tagging
LinkedIn Endorsements: Reputation, Virality, and Social TaggingLinkedIn Endorsements: Reputation, Virality, and Social Tagging
LinkedIn Endorsements: Reputation, Virality, and Social Tagging
Peter Skomoroch
 
Developing Data Products
Developing Data ProductsDeveloping Data Products
Developing Data Products
Peter Skomoroch
 
Practical Problem Solving with Data - Onlab Data Conference, Tokyo
Practical Problem Solving with Data - Onlab Data Conference, TokyoPractical Problem Solving with Data - Onlab Data Conference, Tokyo
Practical Problem Solving with Data - Onlab Data Conference, Tokyo
Peter Skomoroch
 
Street Fighting Data Science
Street Fighting Data ScienceStreet Fighting Data Science
Street Fighting Data Science
Peter Skomoroch
 
Data Mashups -Data Science Summit
Data Mashups -Data Science SummitData Mashups -Data Science Summit
Data Mashups -Data Science Summit
Peter Skomoroch
 
Geo Analytics Tutorial - Where 2.0 2011
Geo Analytics Tutorial - Where 2.0 2011Geo Analytics Tutorial - Where 2.0 2011
Geo Analytics Tutorial - Where 2.0 2011
Peter Skomoroch
 
Rapid Data Exploration With Hadoop
Rapid Data Exploration With HadoopRapid Data Exploration With Hadoop
Rapid Data Exploration With Hadoop
Peter Skomoroch
 

More from Peter Skomoroch (15)

Bridging the AI Gap: Building Stakeholder Support
Bridging the AI Gap: Building Stakeholder SupportBridging the AI Gap: Building Stakeholder Support
Bridging the AI Gap: Building Stakeholder Support
 
Managing Machines: The New AI Dev Stack
Managing Machines: The New AI Dev StackManaging Machines: The New AI Dev Stack
Managing Machines: The New AI Dev Stack
 
Product Management for AI
Product Management for AIProduct Management for AI
Product Management for AI
 
Executive Briefing: Why managing machines is harder than you think
Executive Briefing: Why managing machines is harder than you thinkExecutive Briefing: Why managing machines is harder than you think
Executive Briefing: Why managing machines is harder than you think
 
Building Competitive Moats With Data
Building Competitive Moats With DataBuilding Competitive Moats With Data
Building Competitive Moats With Data
 
O'Reilly Strata: Distilling Data Exhaust
O'Reilly Strata: Distilling Data ExhaustO'Reilly Strata: Distilling Data Exhaust
O'Reilly Strata: Distilling Data Exhaust
 
SF Data Science: Developing Data Products
SF Data Science: Developing Data ProductsSF Data Science: Developing Data Products
SF Data Science: Developing Data Products
 
Skills, Reputation, and Search
Skills, Reputation, and SearchSkills, Reputation, and Search
Skills, Reputation, and Search
 
LinkedIn Endorsements: Reputation, Virality, and Social Tagging
LinkedIn Endorsements: Reputation, Virality, and Social TaggingLinkedIn Endorsements: Reputation, Virality, and Social Tagging
LinkedIn Endorsements: Reputation, Virality, and Social Tagging
 
Developing Data Products
Developing Data ProductsDeveloping Data Products
Developing Data Products
 
Practical Problem Solving with Data - Onlab Data Conference, Tokyo
Practical Problem Solving with Data - Onlab Data Conference, TokyoPractical Problem Solving with Data - Onlab Data Conference, Tokyo
Practical Problem Solving with Data - Onlab Data Conference, Tokyo
 
Street Fighting Data Science
Street Fighting Data ScienceStreet Fighting Data Science
Street Fighting Data Science
 
Data Mashups -Data Science Summit
Data Mashups -Data Science SummitData Mashups -Data Science Summit
Data Mashups -Data Science Summit
 
Geo Analytics Tutorial - Where 2.0 2011
Geo Analytics Tutorial - Where 2.0 2011Geo Analytics Tutorial - Where 2.0 2011
Geo Analytics Tutorial - Where 2.0 2011
 
Rapid Data Exploration With Hadoop
Rapid Data Exploration With HadoopRapid Data Exploration With Hadoop
Rapid Data Exploration With Hadoop
 

Recently uploaded

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 

Elasticwulf Pycon Talk

  • 1. MPI Cluster Programming with Python and Amazon EC2 Pete Skomoroch datawrangling.com juiceanalytics.com/writing
  • 2. Outline Netflix Prize & Amazon EC2 Python Parallel Programming Options ElasticWulf MPI basics in Python Demo: ElasticWulf, mpi4py, Ipython1 ElasticWulf Performance EC2 pointers + Q&A
  • 3. The Netflix Prize 17K movies 500K users 100M ratings 2 GB raw data A “big” computation? 10% improvement of RMSE wins $1 Million
  • 4. Crunching the data at home... Use the Pyflix library to squeeze dataset into 600 MB http://pyflix.python-hosting.com Simon Funk iterative SVD algorithm runs on your laptop overnight “Timely Development” code gets us to 4% improvement over Cinematch Use Numpy/Scipy, call C when needed
  • 5. I needed more CPUs Basic algorithm ties up your machine for 13 hours Some algorithms take weeks... Need runs over many sets of parameters Need to run cross validation over large datasets Bugs in long jobs suck The best approach so far ( Bell Labs ) merged the successful results of over 107 different algorithms
  • 6. But this was my only machine...
  • 7. How can I get a Beowulf cluster? Cluster of nearly identical commodity machines Employ message passing model of parallel computation Often have shared filesystem
  • 8. Amazon EC2 __init__( ) Launch instances of Amazon Machine Images (AMIs) from your Python code Pay only for what you use (wall clock time) http://www.flickr.com/photos/steverosebush/2241578490/
  • 9. EC2 Instance Types Small 1x Large 4x ExtraLarge 8x RAM 1.7GB 7.5GB 15GB Disk 160GB 850GB 1.6TB CPU (1.7Ghz) 1 32bit 4 64bit 8 64bit I/O Moderate High High Performance Price $0.10 $0.40 $0.80 (per instance-hour)
  • 10. Driving EC2 using Python yum -y install python-boto Blog post: “Amazon EC2 Basics for Python Programmers” - James Gardner PyCon talk: “Like Switching on the Light: Managing an Elastic Compute Cluster with Python” George Belotsky; Heath Johns http://del.icio.us/pskomoroch/ec2
  • 11. Parallel Programming in Python MapReduce (Hadoop + Python) Python MPI options (mpi4py, pyMPI, ...) Wrap existing C++/Fortran libs (ScaLAPACK,PETSc, ...) Pyro Twisted IPython1 Which one you use depends on your particular situation These are not mutually exclusive or exhaustive...
  • 13. ElasticWulf - batteries included Master and worker beowulf node Amazon Machine Images Python command line scripts to launch/configure cluster Includes Ipython1 and other good stuff... The AMIs are publicly visible Updated python scripts + docs will be on Google Code BLAS/LAPACK OpenMPI Xwindows Twisted Numpy/Scipy MPICH NFS Ipython1 ipython MPICH2 Ganglia mpi4py matplotlib LAM C3 tools boto
  • 14. What is MPI? High performance message passing interface (MPI) Standard protocol implemented in multiple languages Point to Point - Collective Operations Very flexible, complex... We will just look at a use case involving a master process broadcasting data and receiving results from slave processes via simple primitives (bcast(), scatter(), gather(), reduce())
  • 15. MPI Basics in Python Lets look at some code... size attribute: number of cooperating processes rank attribute: unique identifier of a process We will cover some PyMPI examples, but I would recommend using mpi4py (moved over to scipy, used by Ipython1) http://mpi4py.scipy.org/ The program structure is nearly identical in either implementation.
  • 16. MPI Broadcast mpi.bcast() broadcasts a value from the root process to all other processes
  • 17. MPI Scatter mpi.scatter() scatters an array roughly evenly across processes
  • 18. MPI Gather mpi.gather() Collects results from all processes back to the master process
  • 19. MPI Reduce mpi.reduce() Apply a summary function across all nodes. Like Python reduce (at least until Guido kills it)
  • 20. A simple example Calculating Pi. Throw random darts at a dartboard.
  • 21. Monte Carlo Pi Measure the distance from the origin, count the number of “darts” that are within 1 unit of the origin, and the total number of darts...
  • 22. Throwing more darts 42 inside the circle 8 outside the circle estimated pi is 3.360 ( 42*4 / (42+8) )
  • 24. Throwing darts in parallel
  • 26. Starting up your ElasticWulf Cluster 1) Sign up for Amazon Web Services 2) Get your keys/certificates + define environment variables 4) Download ElasticWulf Python scripts 4) Add your Amazon Id to the ElasticWulf config file 5) ./start-cluster.py -n 3 -s ‘xlarge’ 6) ./ec2-mpi-config.py 7) ssh in to the master node...
  • 27. Demo: Start the cluster $ ./ec2-start-cluster.py
  • 28. Demo: check progress $ ./ec2-check-instances.py
  • 29. Demo: configure the nodes $ ./ec2-mpi-config.py
  • 30. Demo: login to the master node
  • 31. Demo: start the MPI daemons
  • 35. Demo: start ipython1 controller
  • 36. Demo: start engines with mpirun
  • 39. Scaling KNN on ElasticWulf Run pearson correlation between every pair of movies... Use Numpy & mpi4py to scatter the movie ratings vectors Spend $2.40 for 24 cpu hours, trade $ for time
  • 41. Latency: 0.000492 (microseconds) Netpipe Benchmark
  • 42.
  • 43. EC2 “gotchas” EC2 is still in Beta: instances die, freeze, be prepared Relatively high latency Dynamic subnet ec2-upload-bundle --retry /etc/fstab overwritten by default in bundle-vol more: http://del.icio.us/pskomoroch/ec2+gotchas