SlideShare uma empresa Scribd logo
1 de 24
Numba
NumPy-aware dynamic Python compiler

               Travis E. Oliphant


   SciPy 2012. Austin, TX, USA. July 18, 2012
Motivation
• Python is great for rapid development
  and high-level thinking-in-code
• It is slow for interior loops because lack
  of type information leads to a lot of
  indirection and “extra” code.
Motivation
• NumPy users have a lot of type
  information --- but only currently have
  one-size fits all pre-compiled, vectorized
  loops.
• Many new features envisioned will need
  the ability for high-level expressions to
  be compiled to machine code.
Goals
 • Most developers should not have to write
   anything but Python -- or other even higher-
   level Domain Specific Language (DSL).
 • Create faster code using array-expressions from
   NumPy users -- Fortran is the initial target
 • Take advantage of multi-core and GPUs for a
   subset of Python.
Why Not PyPy?
• PyPy does not work with CPython
• PyPy is a (meta) “tracing” JIT. Machine code is
  generated on the fly so there is no “build step” -- but
  we want to support a “build step” when justified
• PyPy tries to speed up everything -- we want to
  optimize more specifically on numeric codes
  (including complex numbers)
               More to the story...
Why not Cython?

• Cython is great for what it does, but...
• Cython creates extension modules which cannot be
  “unloaded” dynamically
• Cython requires a full C-compiler
• Cython doesn’t do type inference -- you have to
  declare types on everything
• Cython is another syntax to learn
What’s the real motivation...
• “Computed columns” for data-types
• Always been bothered by how to write a fast-version
  of “vectorize”
• and... I wanted to play with LLVM!
More Ranting
• The world needs more array-oriented compilers --
  Python has needed one for a decade at least.
• Array-oriented computing needs more light in CS
  curricula
• Most domain experts can write what they want at a
  high-level. Commonly this is then “translated” to a
  lower-level and then the compiler gets a hold of it.
  This is sub-optimal.
• Projects discussed are doing this, but still niche.
  Copperhead, Theano, etc.
More Ranting
• Today’s vector machines (and vector co-processors,
  or GPUS) were made for array-oriented computing.
• The software stack has just not caught up ---
  unfortunate because APL came out in 1963.
• There is a reason Fortran remains popular.
Array-Oriented Computing
• Loosely defined as “Organize data-together” and
 operate on it together (or in cache-size chunks) with
 array-level operations (e.g. NumPy)
              Object                           Attr1   Attr2   Attr3
              Attr1    Object
    Object                           Object1
              Attr2    Attr1
    Attr1
              Attr3    Attr2         Object2
    Attr2
                       Attr3
    Attr3                            Object3

              Object                 Object4
     Object   Attr1
                       Object        Object5
      Attr1   Attr2
                        Attr1
      Attr2   Attr3                  Object6
                        Attr2
      Attr3             Attr3
Goal:

        Numba should be the world’s best
           array-oriented compiler.
NumPy + Mamba = Numba
 Python Function                         Machine Code


                       LLVM-PY

                   LLVM Library
       ISPC   OpenCL    OpenMP    CUDA      CLANG

    Intel     AMD        Nvidia     Apple       ARM
Ufuncs


                Generalized
                 UFuncs
                                                          Python
                                                         Function
                 Window
                 Kernel
                  Funcs

                 Function-
                                                                    Uses of Numba




                   based
                 Indexing


                 Memory
                  Filters
                                                 Numba




NumPy Runtime
                I/O Filters



                Reduction
                 Filters


                Computed
                Columns
                              function pointer
Uses of Numba in SciPy

     optimize                   integrate


     special                       ode



     writing more of SciPy at high-level
Numba --- a deeper look

   Numba is a Python to LLVM translator. It
   translates Python to LLVM IR (the LLVM
   machinery is then used to create machine
  code from there). Numba is NumPy aware
    --- it understands NumPy’s type system,
      methods, C-API, and data-structures
Numba -- written in Python
 • Numba itself is pure Python -- it uses (an
   updated) LLVM-py to interact with the LLVM
   C++ library to build a representation of the
   code in LLVM assembler.
 • LLVM then creates machine code (or a
   “bitcode” module which can be persisted or
   sent to another machine)
 • Machine-code is equivalent to a C-level
   function-pointer (e.g. a ctypes function)
Example
Examples
Demo
Status and Future
• Current master branch mostly due to Jon Riehl
  (Resilient Science) sponsored by Continuum
  Analytics, Inc. --- interprets bytecode directly
• New devel branch working with AST directly and
  making rapid progress
  - Mark Florrison (minivect)
  - Siu Kwan Lam (pymothoa)
Software Stack Future?
         Plateaus of Code re-use + DSLs
   SQL                                R
            TDPL                                Matlab


                    Python


             OBJC                C
  FORTRAN                                 C++



                     LLVM
Join Us!



      http://numba.github.com/numba

Mais conteúdo relacionado

Mais procurados

マルチコアを用いた画像処理
マルチコアを用いた画像処理マルチコアを用いた画像処理
マルチコアを用いた画像処理Norishige Fukushima
 
AI Hardware Landscape 2021
AI Hardware Landscape 2021AI Hardware Landscape 2021
AI Hardware Landscape 2021Grigory Sapunov
 
Rosbag search system
Rosbag search systemRosbag search system
Rosbag search systemyusuke shibui
 
Deep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & FutureDeep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & FutureRouyun Pan
 
Artificial Intelligence, Machine Learning and Deep Learning
Artificial Intelligence, Machine Learning and Deep LearningArtificial Intelligence, Machine Learning and Deep Learning
Artificial Intelligence, Machine Learning and Deep LearningSujit Pal
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
 
Fine tuning large LMs
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMsSylvainGugger
 
Unsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our WorldUnsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our WorldSakha Global
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 
Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"Fwdays
 
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...Guangrui Liu
 
TinyML: Machine Learning for Microcontrollers
TinyML: Machine Learning for MicrocontrollersTinyML: Machine Learning for Microcontrollers
TinyML: Machine Learning for MicrocontrollersRobert John
 
Machine learning in production
Machine learning in productionMachine learning in production
Machine learning in productionTuri, Inc.
 
Autoencoders in Deep Learning
Autoencoders in Deep LearningAutoencoders in Deep Learning
Autoencoders in Deep Learningmilad abbasi
 

Mais procurados (20)

マルチコアを用いた画像処理
マルチコアを用いた画像処理マルチコアを用いた画像処理
マルチコアを用いた画像処理
 
AI Hardware Landscape 2021
AI Hardware Landscape 2021AI Hardware Landscape 2021
AI Hardware Landscape 2021
 
Rosbag search system
Rosbag search systemRosbag search system
Rosbag search system
 
Deep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & FutureDeep Learning Hardware: Past, Present, & Future
Deep Learning Hardware: Past, Present, & Future
 
Artificial Intelligence, Machine Learning and Deep Learning
Artificial Intelligence, Machine Learning and Deep LearningArtificial Intelligence, Machine Learning and Deep Learning
Artificial Intelligence, Machine Learning and Deep Learning
 
JETSON : AI at the EDGE
JETSON : AI at the EDGEJETSON : AI at the EDGE
JETSON : AI at the EDGE
 
Autoencoder
AutoencoderAutoencoder
Autoencoder
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Fine tuning large LMs
Fine tuning large LMsFine tuning large LMs
Fine tuning large LMs
 
Unsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our WorldUnsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our World
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"
 
High–Performance Computing
High–Performance ComputingHigh–Performance Computing
High–Performance Computing
 
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...
Poster - Convolutional Neural Networks for Real-time Road Sign Detection-V3Mr...
 
Mobilenet
MobilenetMobilenet
Mobilenet
 
TinyML: Machine Learning for Microcontrollers
TinyML: Machine Learning for MicrocontrollersTinyML: Machine Learning for Microcontrollers
TinyML: Machine Learning for Microcontrollers
 
Machine learning in production
Machine learning in productionMachine learning in production
Machine learning in production
 
Python vs c++ ppt
Python vs c++ pptPython vs c++ ppt
Python vs c++ ppt
 
Autoencoders in Deep Learning
Autoencoders in Deep LearningAutoencoders in Deep Learning
Autoencoders in Deep Learning
 

Destaque

ニューラル機械翻訳の動向@IBIS2017
ニューラル機械翻訳の動向@IBIS2017ニューラル機械翻訳の動向@IBIS2017
ニューラル機械翻訳の動向@IBIS2017Toshiaki Nakazawa
 
GPU Computing With Apache Spark And Python
GPU Computing With Apache Spark And PythonGPU Computing With Apache Spark And Python
GPU Computing With Apache Spark And PythonJen Aman
 
The State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R EcosystemThe State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R EcosystemIntel® Software
 
Buzzwords Numba Presentation
Buzzwords Numba PresentationBuzzwords Numba Presentation
Buzzwords Numba Presentationkammeyer
 
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
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyTravis Oliphant
 
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...Naoki (Neo) SATO
 
チームで取り組む!アクセシビリティコーディング&デザイン
チームで取り組む!アクセシビリティコーディング&デザインチームで取り組む!アクセシビリティコーディング&デザイン
チームで取り組む!アクセシビリティコーディング&デザインKobayashi Daisuke
 
4つの戦犯から考えるサービスづくりの失敗
4つの戦犯から考えるサービスづくりの失敗4つの戦犯から考えるサービスづくりの失敗
4つの戦犯から考えるサービスづくりの失敗toshihiro ichitani
 

Destaque (11)

ニューラル機械翻訳の動向@IBIS2017
ニューラル機械翻訳の動向@IBIS2017ニューラル機械翻訳の動向@IBIS2017
ニューラル機械翻訳の動向@IBIS2017
 
GPU Computing With Apache Spark And Python
GPU Computing With Apache Spark And PythonGPU Computing With Apache Spark And Python
GPU Computing With Apache Spark And Python
 
The State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R EcosystemThe State of High-Performance Computing in the Open-Source R Ecosystem
The State of High-Performance Computing in the Open-Source R Ecosystem
 
Buzzwords Numba Presentation
Buzzwords Numba PresentationBuzzwords Numba Presentation
Buzzwords Numba Presentation
 
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 ...
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPy
 
米国のペネトレーションテスト事情(ssmjp)
米国のペネトレーションテスト事情(ssmjp)米国のペネトレーションテスト事情(ssmjp)
米国のペネトレーションテスト事情(ssmjp)
 
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...
[Microsoft Tech Summit 2017] マイクロサービスだけじゃない! コンテナー オーケストレーターとしての「Azure Servic...
 
チームで取り組む!アクセシビリティコーディング&デザイン
チームで取り組む!アクセシビリティコーディング&デザインチームで取り組む!アクセシビリティコーディング&デザイン
チームで取り組む!アクセシビリティコーディング&デザイン
 
4つの戦犯から考えるサービスづくりの失敗
4つの戦犯から考えるサービスづくりの失敗4つの戦犯から考えるサービスづくりの失敗
4つの戦犯から考えるサービスづくりの失敗
 

Semelhante a Numba

The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPykammeyer
 
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
 
Python in the real world : from everyday applications to advanced robotics
Python in the real world : from everyday applications to advanced roboticsPython in the real world : from everyday applications to advanced robotics
Python in the real world : from everyday applications to advanced roboticsJivitesh Dhaliwal
 
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
 
Toward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBToward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBmelaneum
 
Pythonic doesn't mean slow!
Pythonic doesn't mean slow!Pythonic doesn't mean slow!
Pythonic doesn't mean slow!Ronan Lamy
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009Paolo Negri
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysisPramod Toraskar
 
Building SciPy kernels with Pythran
Building SciPy kernels with PythranBuilding SciPy kernels with Pythran
Building SciPy kernels with PythranRalf Gommers
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsHenry Schreiner
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...pythoncharmers
 
Parallelism in a NumPy-based program
Parallelism in a NumPy-based programParallelism in a NumPy-based program
Parallelism in a NumPy-based programRalf Gommers
 
Keynote at Converge 2019
Keynote at Converge 2019Keynote at Converge 2019
Keynote at Converge 2019Travis 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
 
Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Boey Pak Cheong
 

Semelhante a Numba (20)

The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPy
 
Numba lightning
Numba lightningNumba lightning
Numba lightning
 
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
 
Python in the real world : from everyday applications to advanced robotics
Python in the real world : from everyday applications to advanced roboticsPython in the real world : from everyday applications to advanced robotics
Python in the real world : from everyday applications to advanced robotics
 
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"
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Toward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTBToward a gui remote-sensing environment built over OTB
Toward a gui remote-sensing environment built over OTB
 
Python for ML.pptx
Python for ML.pptxPython for ML.pptx
Python for ML.pptx
 
Pythonic doesn't mean slow!
Pythonic doesn't mean slow!Pythonic doesn't mean slow!
Pythonic doesn't mean slow!
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
 
Building SciPy kernels with Pythran
Building SciPy kernels with PythranBuilding SciPy kernels with Pythran
Building SciPy kernels with Pythran
 
Elasticwulf Pycon Talk
Elasticwulf Pycon TalkElasticwulf Pycon Talk
Elasticwulf Pycon Talk
 
Multicore
MulticoreMulticore
Multicore
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
 
Parallelism in a NumPy-based program
Parallelism in a NumPy-based programParallelism in a NumPy-based program
Parallelism in a NumPy-based program
 
Keynote at Converge 2019
Keynote at Converge 2019Keynote at Converge 2019
Keynote at Converge 2019
 
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
 
Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015Concurrency and Python - PyCon MY 2015
Concurrency and Python - PyCon MY 2015
 

Mais de Travis Oliphant

Array computing and the evolution of SciPy, NumPy, and PyData
Array computing and the evolution of SciPy, NumPy, and PyDataArray computing and the evolution of SciPy, NumPy, and PyData
Array computing and the evolution of SciPy, NumPy, and PyDataTravis Oliphant
 
SciPy Latin America 2019
SciPy Latin America 2019SciPy Latin America 2019
SciPy Latin America 2019Travis Oliphant
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationTravis Oliphant
 
Scaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUsScaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUsTravis Oliphant
 
PyData Barcelona Keynote
PyData Barcelona KeynotePyData Barcelona Keynote
PyData Barcelona KeynoteTravis Oliphant
 
Python for Data Science with Anaconda
Python for Data Science with AnacondaPython for Data Science with Anaconda
Python for Data Science with AnacondaTravis Oliphant
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable PythonTravis Oliphant
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and OutTravis Oliphant
 
Python as the Zen of Data Science
Python as the Zen of Data SciencePython as the Zen of Data Science
Python as the Zen of Data ScienceTravis Oliphant
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData SolutionsTravis Oliphant
 
Continuum Analytics and Python
Continuum Analytics and PythonContinuum Analytics and Python
Continuum Analytics and PythonTravis Oliphant
 
Effectively using Open Source with conda
Effectively using Open Source with condaEffectively using Open Source with conda
Effectively using Open Source with condaTravis Oliphant
 
Blaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonBlaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonTravis Oliphant
 

Mais de Travis Oliphant (17)

Array computing and the evolution of SciPy, NumPy, and PyData
Array computing and the evolution of SciPy, NumPy, and PyDataArray computing and the evolution of SciPy, NumPy, and PyData
Array computing and the evolution of SciPy, NumPy, and PyData
 
SciPy Latin America 2019
SciPy Latin America 2019SciPy Latin America 2019
SciPy Latin America 2019
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft Presentation
 
Scaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUsScaling Python to CPUs and GPUs
Scaling Python to CPUs and GPUs
 
PyData Barcelona Keynote
PyData Barcelona KeynotePyData Barcelona Keynote
PyData Barcelona Keynote
 
Python for Data Science with Anaconda
Python for Data Science with AnacondaPython for Data Science with Anaconda
Python for Data Science with Anaconda
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable Python
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and Out
 
Python as the Zen of Data Science
Python as the Zen of Data SciencePython as the Zen of Data Science
Python as the Zen of Data Science
 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData Solutions
 
Continuum Analytics and Python
Continuum Analytics and PythonContinuum Analytics and Python
Continuum Analytics and Python
 
Bids talk 9.18
Bids talk 9.18Bids talk 9.18
Bids talk 9.18
 
Effectively using Open Source with conda
Effectively using Open Source with condaEffectively using Open Source with conda
Effectively using Open Source with conda
 
London level39
London level39London level39
London level39
 
Blaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for PythonBlaze: a large-scale, array-oriented infrastructure for Python
Blaze: a large-scale, array-oriented infrastructure for Python
 
PyData Introduction
PyData IntroductionPyData Introduction
PyData Introduction
 

Último

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Numba

  • 1. Numba NumPy-aware dynamic Python compiler Travis E. Oliphant SciPy 2012. Austin, TX, USA. July 18, 2012
  • 2. Motivation • Python is great for rapid development and high-level thinking-in-code • It is slow for interior loops because lack of type information leads to a lot of indirection and “extra” code.
  • 3. Motivation • NumPy users have a lot of type information --- but only currently have one-size fits all pre-compiled, vectorized loops. • Many new features envisioned will need the ability for high-level expressions to be compiled to machine code.
  • 4. Goals • Most developers should not have to write anything but Python -- or other even higher- level Domain Specific Language (DSL). • Create faster code using array-expressions from NumPy users -- Fortran is the initial target • Take advantage of multi-core and GPUs for a subset of Python.
  • 5. Why Not PyPy? • PyPy does not work with CPython • PyPy is a (meta) “tracing” JIT. Machine code is generated on the fly so there is no “build step” -- but we want to support a “build step” when justified • PyPy tries to speed up everything -- we want to optimize more specifically on numeric codes (including complex numbers) More to the story...
  • 6. Why not Cython? • Cython is great for what it does, but... • Cython creates extension modules which cannot be “unloaded” dynamically • Cython requires a full C-compiler • Cython doesn’t do type inference -- you have to declare types on everything • Cython is another syntax to learn
  • 7. What’s the real motivation... • “Computed columns” for data-types • Always been bothered by how to write a fast-version of “vectorize” • and... I wanted to play with LLVM!
  • 8. More Ranting • The world needs more array-oriented compilers -- Python has needed one for a decade at least. • Array-oriented computing needs more light in CS curricula • Most domain experts can write what they want at a high-level. Commonly this is then “translated” to a lower-level and then the compiler gets a hold of it. This is sub-optimal. • Projects discussed are doing this, but still niche. Copperhead, Theano, etc.
  • 9. More Ranting • Today’s vector machines (and vector co-processors, or GPUS) were made for array-oriented computing. • The software stack has just not caught up --- unfortunate because APL came out in 1963. • There is a reason Fortran remains popular.
  • 10. Array-Oriented Computing • Loosely defined as “Organize data-together” and operate on it together (or in cache-size chunks) with array-level operations (e.g. NumPy) Object Attr1 Attr2 Attr3 Attr1 Object Object Object1 Attr2 Attr1 Attr1 Attr3 Attr2 Object2 Attr2 Attr3 Attr3 Object3 Object Object4 Object Attr1 Object Object5 Attr1 Attr2 Attr1 Attr2 Attr3 Object6 Attr2 Attr3 Attr3
  • 11. Goal: Numba should be the world’s best array-oriented compiler.
  • 12. NumPy + Mamba = Numba Python Function Machine Code LLVM-PY LLVM Library ISPC OpenCL OpenMP CUDA CLANG Intel AMD Nvidia Apple ARM
  • 13. Ufuncs Generalized UFuncs Python Function Window Kernel Funcs Function- Uses of Numba based Indexing Memory Filters Numba NumPy Runtime I/O Filters Reduction Filters Computed Columns function pointer
  • 14. Uses of Numba in SciPy optimize integrate special ode writing more of SciPy at high-level
  • 15. Numba --- a deeper look Numba is a Python to LLVM translator. It translates Python to LLVM IR (the LLVM machinery is then used to create machine code from there). Numba is NumPy aware --- it understands NumPy’s type system, methods, C-API, and data-structures
  • 16. Numba -- written in Python • Numba itself is pure Python -- it uses (an updated) LLVM-py to interact with the LLVM C++ library to build a representation of the code in LLVM assembler. • LLVM then creates machine code (or a “bitcode” module which can be persisted or sent to another machine) • Machine-code is equivalent to a C-level function-pointer (e.g. a ctypes function)
  • 19.
  • 20.
  • 21. Demo
  • 22. Status and Future • Current master branch mostly due to Jon Riehl (Resilient Science) sponsored by Continuum Analytics, Inc. --- interprets bytecode directly • New devel branch working with AST directly and making rapid progress - Mark Florrison (minivect) - Siu Kwan Lam (pymothoa)
  • 23. Software Stack Future? Plateaus of Code re-use + DSLs SQL R TDPL Matlab Python OBJC C FORTRAN C++ LLVM
  • 24. Join Us! http://numba.github.com/numba

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n