SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
Numba:

A JIT Compiler for Scientific
Python
1
Stan Seibert
Continuum Analytics
January 22, 2015
Why Python?
• For many programs, the most important resource
is developer time.
• The best code is:
• Easy to read
• Easy to understand
• Easy to modify
• But sometimes execution speed does matter.

Then what do you do?
2
Achieving Performance in Python
When you need speed in Python the most important
things you can do are:
1. Use profiling to understand where your
program spends time.

(Most of your code is irrelevant. Only worry
about the parts that matter.)
2. Leverage NumPy and SciPy when working
with numerical code.
3. Take a look at Numba…
3
How can Numba help?
• Numba is an open source Just-In-Time compiler
for Python functions.
• From the types of the function arguments, Numba
can often generate a specialized, fast, machine code
implementation at runtime.
• Designed to work best with numerical code and
NumPy arrays.
• Uses the LLVM library as the compiler backend.
4
Numba Features
• Numba supports:
• Windows (XP and later), OS X (10.7 and later), and
Linux
• 32 and 64-bit x86 CPUs and NVIDIA GPUs
• Python 2 and 3
• NumPy versions 1.6 through 1.9
• It does not require a C/C++ compiler on the user’s system.
• Requires less than 70 MB to install.
• Does not replace the standard Python interpreter

(all of your existing Python libraries are still available)
5
Creating a Ufunc
• Numba is the best way to make new ufuncs for
working with NumPy arrays
6
Compiling a Function
• Sometimes you can’t create a simple or efficient
array expression or ufunc. Use Numba to work
with array elements directly.
• Example: Suppose you have a boolean grid and you
want to find the maximum number neighbors a
cell has in the grid:
1 1 1
1 1 1 1 1
1 1 1 1 2 1
1 1 1 1 3 2 1
2 2 1 1 2 1
2 2 2 2 2
1 1 1 1 1
1 1 1
Compiling a Function
Compiling a Function
• Very hard to express this calculation purely as
array operations (and even if you do, it is likely
unreadable to non-NumPy experts).
• Numba let’s you write out the loops, but avoid the
penalty for having to loop over individual elements
in the Python interpreter:
169x faster!
9
Different Modes of Compilation
• Numba automatically selects between two different
levels of optimization when compiling a function:
• “object mode”: supports nearly all of Python, but
generally cannot speed up code by a large factor

(exception: see next slide)
• “nopython mode”: supports a subset of Python,
but runs at C/C++/FORTRAN speeds
10
Loop-Lifting
• In object mode, Numba will attempt to extract
loops and compile them in nopython mode.
• Works great for functions that are bookended by
uncompilable code, but have a compilable core
loop.
• All happens automatically.
11
Loop-Lifting
object mode
object mode
nopython mode
12
Nopython Mode Features
• Standard control and looping structures: if, else, while, for, range
• NumPy arrays, int, float, complex, booleans, and tuples
• Almost all arithmetic, logical, and bitwise operators as well as
functions from the math and numpy modules
• Nearly all NumPy dtypes: int, float, complex, datetime64,
timedelta64
• Array element access (read and write)
• Array reduction functions: sum, prod, max, min, etc
• Calling other nopython mode compiled functions
• Calling ctypes or cffi-wrapped external functions
13
Compiling for the GPU
GPU functions are called differently, but it is still Python!
MacBook Pro w/ GTX 650M GPU
Advanced Use Cases
• Compile new functions based on user input.
• Great for inserting a user-provided math
expression into a larger algorithm, while still
achieving C speeds.
• Optimization (least squares, etc) libraries that can
recompile themselves to inline a specific objective
function right into the algorithm
• Multithreaded calculation without having to worry
about the global interpreter lock (GIL).
15
NumbaPro
• NumbaPro adds higher level features on top of
Numba:
• Create ufuncs that run multithreaded on the
CPU or on the GPU
• GPU linear algebra
• GPU FFTs
16
Conclusion
• Numba is a JIT compiler than understands Python!
• Achieve the same speeds as compiled languages for
numerical and array-processing code.
• Can be used to create advanced workflows where
user input drives compilation at runtime.
• Open source, available at:
http://numba.pydata.org/
• Or:
conda	
  install	
  numba
17

Mais conteúdo relacionado

Destaque

Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and OutTravis Oliphant
 
Numba: Flexible analytics written in Python with machine-code speeds and avo...
Numba:  Flexible analytics written in Python with machine-code speeds and avo...Numba:  Flexible analytics written in Python with machine-code speeds and avo...
Numba: Flexible analytics written in Python with machine-code speeds and avo...PyData
 
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Intel® Software
 
Buzzwords Numba Presentation
Buzzwords Numba PresentationBuzzwords Numba Presentation
Buzzwords Numba Presentationkammeyer
 

Destaque (6)

Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and Out
 
Scala.io
Scala.ioScala.io
Scala.io
 
PyData Paris 2015 - Track 3.3 Antoine Pitrou
PyData Paris 2015 - Track 3.3 Antoine PitrouPyData Paris 2015 - Track 3.3 Antoine Pitrou
PyData Paris 2015 - Track 3.3 Antoine Pitrou
 
Numba: Flexible analytics written in Python with machine-code speeds and avo...
Numba:  Flexible analytics written in Python with machine-code speeds and avo...Numba:  Flexible analytics written in Python with machine-code speeds and avo...
Numba: Flexible analytics written in Python with machine-code speeds and avo...
 
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
Accelerate Your Python* Code through Profiling, Tuning, and Compilation Part ...
 
Buzzwords Numba Presentation
Buzzwords Numba PresentationBuzzwords Numba Presentation
Buzzwords Numba Presentation
 

Semelhante a Numba Overview

Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataTravis Oliphant
 
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 Numbastan_seibert
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Want to write a book in Jupyter - here's how
Want to write a book in Jupyter - here's howWant to write a book in Jupyter - here's how
Want to write a book in Jupyter - here's howJim Arlow
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendLuis Goldster
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendFraboni Ec
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendYoung Alista
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendJames Wong
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendHarry Potter
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendTony Nguyen
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendHoang Nguyen
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Fwdays
 
Building SciPy kernels with Pythran
Building SciPy kernels with PythranBuilding SciPy kernels with Pythran
Building SciPy kernels with PythranRalf Gommers
 
Preparing Codes for Intel Knights Landing (KNL)
Preparing Codes for Intel Knights Landing (KNL)Preparing Codes for Intel Knights Landing (KNL)
Preparing Codes for Intel Knights Landing (KNL)AllineaSoftware
 

Semelhante a Numba Overview (20)

Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyData
 
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
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
OpenMP
OpenMPOpenMP
OpenMP
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Want to write a book in Jupyter - here's how
Want to write a book in Jupyter - here's howWant to write a book in Jupyter - here's how
Want to write a book in Jupyter - here's how
 
Python for ML.pptx
Python for ML.pptxPython for ML.pptx
Python for ML.pptx
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Building SciPy kernels with Pythran
Building SciPy kernels with PythranBuilding SciPy kernels with Pythran
Building SciPy kernels with Pythran
 
Numba lightning
Numba lightningNumba lightning
Numba lightning
 
An Introduction to PyPy
An Introduction to PyPyAn Introduction to PyPy
An Introduction to PyPy
 
Preparing Codes for Intel Knights Landing (KNL)
Preparing Codes for Intel Knights Landing (KNL)Preparing Codes for Intel Knights Landing (KNL)
Preparing Codes for Intel Knights Landing (KNL)
 

Último

Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainAbdul Ahad
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 

Último (20)

Data modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software DomainData modeling 101 - Basics - Software Domain
Data modeling 101 - Basics - Software Domain
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 

Numba Overview

  • 1. Numba:
 A JIT Compiler for Scientific Python 1 Stan Seibert Continuum Analytics January 22, 2015
  • 2. Why Python? • For many programs, the most important resource is developer time. • The best code is: • Easy to read • Easy to understand • Easy to modify • But sometimes execution speed does matter.
 Then what do you do? 2
  • 3. Achieving Performance in Python When you need speed in Python the most important things you can do are: 1. Use profiling to understand where your program spends time.
 (Most of your code is irrelevant. Only worry about the parts that matter.) 2. Leverage NumPy and SciPy when working with numerical code. 3. Take a look at Numba… 3
  • 4. How can Numba help? • Numba is an open source Just-In-Time compiler for Python functions. • From the types of the function arguments, Numba can often generate a specialized, fast, machine code implementation at runtime. • Designed to work best with numerical code and NumPy arrays. • Uses the LLVM library as the compiler backend. 4
  • 5. Numba Features • Numba supports: • Windows (XP and later), OS X (10.7 and later), and Linux • 32 and 64-bit x86 CPUs and NVIDIA GPUs • Python 2 and 3 • NumPy versions 1.6 through 1.9 • It does not require a C/C++ compiler on the user’s system. • Requires less than 70 MB to install. • Does not replace the standard Python interpreter
 (all of your existing Python libraries are still available) 5
  • 6. Creating a Ufunc • Numba is the best way to make new ufuncs for working with NumPy arrays 6
  • 7. Compiling a Function • Sometimes you can’t create a simple or efficient array expression or ufunc. Use Numba to work with array elements directly. • Example: Suppose you have a boolean grid and you want to find the maximum number neighbors a cell has in the grid: 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 3 2 1 2 2 1 1 2 1 2 2 2 2 2 1 1 1 1 1 1 1 1
  • 9. Compiling a Function • Very hard to express this calculation purely as array operations (and even if you do, it is likely unreadable to non-NumPy experts). • Numba let’s you write out the loops, but avoid the penalty for having to loop over individual elements in the Python interpreter: 169x faster! 9
  • 10. Different Modes of Compilation • Numba automatically selects between two different levels of optimization when compiling a function: • “object mode”: supports nearly all of Python, but generally cannot speed up code by a large factor
 (exception: see next slide) • “nopython mode”: supports a subset of Python, but runs at C/C++/FORTRAN speeds 10
  • 11. Loop-Lifting • In object mode, Numba will attempt to extract loops and compile them in nopython mode. • Works great for functions that are bookended by uncompilable code, but have a compilable core loop. • All happens automatically. 11
  • 13. Nopython Mode Features • Standard control and looping structures: if, else, while, for, range • NumPy arrays, int, float, complex, booleans, and tuples • Almost all arithmetic, logical, and bitwise operators as well as functions from the math and numpy modules • Nearly all NumPy dtypes: int, float, complex, datetime64, timedelta64 • Array element access (read and write) • Array reduction functions: sum, prod, max, min, etc • Calling other nopython mode compiled functions • Calling ctypes or cffi-wrapped external functions 13
  • 14. Compiling for the GPU GPU functions are called differently, but it is still Python! MacBook Pro w/ GTX 650M GPU
  • 15. Advanced Use Cases • Compile new functions based on user input. • Great for inserting a user-provided math expression into a larger algorithm, while still achieving C speeds. • Optimization (least squares, etc) libraries that can recompile themselves to inline a specific objective function right into the algorithm • Multithreaded calculation without having to worry about the global interpreter lock (GIL). 15
  • 16. NumbaPro • NumbaPro adds higher level features on top of Numba: • Create ufuncs that run multithreaded on the CPU or on the GPU • GPU linear algebra • GPU FFTs 16
  • 17. Conclusion • Numba is a JIT compiler than understands Python! • Achieve the same speeds as compiled languages for numerical and array-processing code. • Can be used to create advanced workflows where user input drives compilation at runtime. • Open source, available at: http://numba.pydata.org/ • Or: conda  install  numba 17