SlideShare a Scribd company logo
1 of 24
Download to read offline
compiler and community
Jiahao Chen
MIT Computer Science and Artificial Intelligence Laboratory
julialang.org
Alan EdelmanJeff Bezanson Stefan Karpinski Viral B. Shah
433 code contributors as of 2014-06-30
The faces of Julia
as of 2014-06-30
The world of
181 package-only developers
252 contributors to julia repo
3,906 stargazers
321 watchers
What’s the big deal about Julia ?
julialang.org/benchmarks
What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary.
“FFTW (FFTs) and BLAS libraries (matrix multiplication)
take ~100,000 lines [of code] to solve problems that can
be implemented in ~15 lines of (slow) code… It usually
isn’t worth it to get the last factor of two in speed”	

!
- Steven Johnson, author of FFTW (emphases his)
What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary. Instead, performance comes
from designing a language that is easy for both
humans and compilers to understand.
!
Multimethods (multiple dispatch) is one of the key
mechanisms.
Object-oriented programming with classes
What can I do with/to a thing?
Object-oriented programming with classes
What can I do with/to a thing?
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
pay fare
lose
buy
methods objects
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
pay fare
lose
buy
methods objects
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
pay fare
lose
buy
class-based OO
!
classes are more
fundamental
than methods
generic
function
objectsmethods
rechargeable
subway
pass
single-use
subway
ticket
is a subtype of
subway
ticket
top up
pay fare
lose
buy
abstract object
Multi-methods with type hierarchy
generic
function
objectsmethods
rechargeable
subway
pass
single-use
subway
ticket
is a subtype of
subway
ticket
top up
pay fare
lose
buy
abstract object
Multi-methods with type hierarchy
Multi-methods for linear algebra
What can I do with/to a thing?
find eigenvalues and eigenvectors
find singular values
find singular values and vectors
find eigenvalues
generic
function
objectsmethods
general matrix
symmetric tridiagonal matrix
bidiagonal matrix
Methods can take advantage of special matrix structures
eigvals
eigfact
svdvals
svdfact
Matrix
SymTridiagonal
Bidiagonal
So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
stev!{T<:BlasFloat} calls sgestv	
dgestv	
cgestv	
zgestv	
and handles workspace
memory allocation
What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary. Instead, performance comes
from designing a language that is easy for both
humans and compilers to understand.
!
!
from the programmer’s point of view:
!
- dynamic language semantics: faster to prototype code
- dynamic types: compiler does not hinder experimentation
- multiple dispatch allows both methods for general
functionality and methods for specialized performance
- low-cost software abstractions allow code to retain
structure of mathematical abstractions
- metaprogramming (with macros) allows code generation:
takes software experimentation to the next level with less
lines of actual code
- flexible syntax, Unicode operators, great community…
Pure-­‐Julia	
  FFT	
  performance2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
2621440
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
12000
13000
14000
speed(mflops)
intel-mkl-dfti in-place
intel-mkl-dfti out-of-place
fftw3 out-of-place
fftw3 in-place
fftw3-no-simd out-of-place
fftw3-no-simd in-place
dfftpack
emayer
julia
bloodworth
cross
cwplib
esrfft
double-precision complex, 1d transforms
powers of two
already	
  comparable	
  to	
  FFTPACK	
  
!
[	
  actually	
  was	
  even	
  a	
  bit	
  better;	
  
	
  	
  	
  some	
  recent	
  inlining	
  
	
  	
  	
  regressions	
  in	
  Julia	
  snapshots	
  ]
Steven Johnson, 2014-06
Presented at NAIS Codegen workshop
from the compiler’s point of view:
!
- dynamic semantics with static analysis: when possible,
offload runtime checks to JIT compile stage
- multiple dispatch requires function signatures that expose
type information
- rich type system allows for detailed type inference
- inlining passes reduce abstraction cost
- automatic code specialization generates many performant
methods
- macros allow further fine-grained tradeoffs between
performance and correctness, e.g. @inbounds, @simd,
…

More Related Content

Viewers also liked

Julia: Multimethods for abstraction and performance
Julia: Multimethods for abstraction and performanceJulia: Multimethods for abstraction and performance
Julia: Multimethods for abstraction and performanceJiahao Chen
 
An introduction to Julia
An introduction to JuliaAn introduction to Julia
An introduction to JuliaJiahao Chen
 
A Julia package for iterative SVDs with applications to genomics data analysis
A Julia package for iterative SVDs with applications to genomics data analysisA Julia package for iterative SVDs with applications to genomics data analysis
A Julia package for iterative SVDs with applications to genomics data analysisJiahao Chen
 
Excitation Energy Transfer In Photosynthetic Membranes
Excitation Energy Transfer In Photosynthetic MembranesExcitation Energy Transfer In Photosynthetic Membranes
Excitation Energy Transfer In Photosynthetic MembranesJiahao Chen
 
Julia, genomics data and their principal components
Julia, genomics data and their principal componentsJulia, genomics data and their principal components
Julia, genomics data and their principal componentsJiahao Chen
 
What's next in Julia
What's next in JuliaWhat's next in Julia
What's next in JuliaJiahao Chen
 
Theory and application of fluctuating-charge models
Theory and application of fluctuating-charge modelsTheory and application of fluctuating-charge models
Theory and application of fluctuating-charge modelsJiahao Chen
 
Python as number crunching code glue
Python as number crunching code gluePython as number crunching code glue
Python as number crunching code glueJiahao Chen
 

Viewers also liked (8)

Julia: Multimethods for abstraction and performance
Julia: Multimethods for abstraction and performanceJulia: Multimethods for abstraction and performance
Julia: Multimethods for abstraction and performance
 
An introduction to Julia
An introduction to JuliaAn introduction to Julia
An introduction to Julia
 
A Julia package for iterative SVDs with applications to genomics data analysis
A Julia package for iterative SVDs with applications to genomics data analysisA Julia package for iterative SVDs with applications to genomics data analysis
A Julia package for iterative SVDs with applications to genomics data analysis
 
Excitation Energy Transfer In Photosynthetic Membranes
Excitation Energy Transfer In Photosynthetic MembranesExcitation Energy Transfer In Photosynthetic Membranes
Excitation Energy Transfer In Photosynthetic Membranes
 
Julia, genomics data and their principal components
Julia, genomics data and their principal componentsJulia, genomics data and their principal components
Julia, genomics data and their principal components
 
What's next in Julia
What's next in JuliaWhat's next in Julia
What's next in Julia
 
Theory and application of fluctuating-charge models
Theory and application of fluctuating-charge modelsTheory and application of fluctuating-charge models
Theory and application of fluctuating-charge models
 
Python as number crunching code glue
Python as number crunching code gluePython as number crunching code glue
Python as number crunching code glue
 

Similar to Julia: compiler and community

FiQuant Market Microstructure Simulator: Strategy Definition Language
FiQuant Market Microstructure Simulator: Strategy Definition LanguageFiQuant Market Microstructure Simulator: Strategy Definition Language
FiQuant Market Microstructure Simulator: Strategy Definition LanguageAnton Kolotaev
 
Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015Corrado Santoro
 
OWF14 - Big Data : The State of Machine Learning in 2014
OWF14 - Big Data : The State of Machine  Learning in 2014OWF14 - Big Data : The State of Machine  Learning in 2014
OWF14 - Big Data : The State of Machine Learning in 2014Paris Open Source Summit
 
Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical Dhruv Gohil
 
Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Grigory Sapunov
 
Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Jordi Cabot
 
Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...SemWebPro
 
Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation pptArt Scott
 
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...DataScienceConferenc1
 
Understanding Jupyter notebooks using bioinformatics examples
Understanding Jupyter notebooks using bioinformatics examplesUnderstanding Jupyter notebooks using bioinformatics examples
Understanding Jupyter notebooks using bioinformatics examplesLynn Langit
 
2014 01-ticosa
2014 01-ticosa2014 01-ticosa
2014 01-ticosaPharo
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationTravis Oliphant
 
Presentation1.2.pptx
Presentation1.2.pptxPresentation1.2.pptx
Presentation1.2.pptxpranaykusuma
 
Pharo: A Reflective System
Pharo: A Reflective SystemPharo: A Reflective System
Pharo: A Reflective SystemPharo
 
GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003butest
 
Pharo: A Reflective System
Pharo: A Reflective SystemPharo: A Reflective System
Pharo: A Reflective SystemMarcus Denker
 
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr Jun-jun Lagman
 

Similar to Julia: compiler and community (20)

FiQuant Market Microstructure Simulator: Strategy Definition Language
FiQuant Market Microstructure Simulator: Strategy Definition LanguageFiQuant Market Microstructure Simulator: Strategy Definition Language
FiQuant Market Microstructure Simulator: Strategy Definition Language
 
Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015Presentation @ Miniscuola WOA 2015
Presentation @ Miniscuola WOA 2015
 
OWF14 - Big Data : The State of Machine Learning in 2014
OWF14 - Big Data : The State of Machine  Learning in 2014OWF14 - Big Data : The State of Machine  Learning in 2014
OWF14 - Big Data : The State of Machine Learning in 2014
 
Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical Nautral Langauge Processing - Basics / Non Technical
Nautral Langauge Processing - Basics / Non Technical
 
Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016Deep Learning and the state of AI / 2016
Deep Learning and the state of AI / 2016
 
Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?Software Modeling and Artificial Intelligence: friends or foes?
Software Modeling and Artificial Intelligence: friends or foes?
 
Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...Sparklis exploration et interrogation de points d'accès sparql par interactio...
Sparklis exploration et interrogation de points d'accès sparql par interactio...
 
Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation ppt
 
Benefits of Extensions
Benefits of ExtensionsBenefits of Extensions
Benefits of Extensions
 
Benefits of Extensions
Benefits of ExtensionsBenefits of Extensions
Benefits of Extensions
 
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
 
Understanding Jupyter notebooks using bioinformatics examples
Understanding Jupyter notebooks using bioinformatics examplesUnderstanding Jupyter notebooks using bioinformatics examples
Understanding Jupyter notebooks using bioinformatics examples
 
2014 01-ticosa
2014 01-ticosa2014 01-ticosa
2014 01-ticosa
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft Presentation
 
Presentation1.2.pptx
Presentation1.2.pptxPresentation1.2.pptx
Presentation1.2.pptx
 
Pharo: A Reflective System
Pharo: A Reflective SystemPharo: A Reflective System
Pharo: A Reflective System
 
GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003GATE, HLT and Machine Learning, Sheffield, July 2003
GATE, HLT and Machine Learning, Sheffield, July 2003
 
Pharo: A Reflective System
Pharo: A Reflective SystemPharo: A Reflective System
Pharo: A Reflective System
 
Oop by edgar lagman jr
Oop by edgar lagman jr Oop by edgar lagman jr
Oop by edgar lagman jr
 
Walter api
Walter apiWalter api
Walter api
 

Julia: compiler and community

  • 1. compiler and community Jiahao Chen MIT Computer Science and Artificial Intelligence Laboratory julialang.org Alan EdelmanJeff Bezanson Stefan Karpinski Viral B. Shah
  • 2. 433 code contributors as of 2014-06-30 The faces of Julia
  • 3. as of 2014-06-30 The world of 181 package-only developers 252 contributors to julia repo 3,906 stargazers 321 watchers
  • 4. What’s the big deal about Julia ? julialang.org/benchmarks
  • 5. What’s the big deal about Julia ? Julia isn’t designed for performance using all means necessary. “FFTW (FFTs) and BLAS libraries (matrix multiplication) take ~100,000 lines [of code] to solve problems that can be implemented in ~15 lines of (slow) code… It usually isn’t worth it to get the last factor of two in speed” ! - Steven Johnson, author of FFTW (emphases his)
  • 6. What’s the big deal about Julia ? Julia isn’t designed for performance using all means necessary. Instead, performance comes from designing a language that is easy for both humans and compilers to understand. ! Multimethods (multiple dispatch) is one of the key mechanisms.
  • 7. Object-oriented programming with classes What can I do with/to a thing?
  • 8. Object-oriented programming with classes What can I do with/to a thing?
  • 9. Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy
  • 10. Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy top up pay fare lose buy
  • 11. Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy top up pay fare lose buy
  • 12. Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy top up pay fare lose buy pay fare lose buy
  • 13. methods objects Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy top up pay fare lose buy pay fare lose buy
  • 14. methods objects Object-oriented programming with classes What can I do with/to a thing? top up pay fare lose buy top up pay fare lose buy pay fare lose buy class-based OO ! classes are more fundamental than methods
  • 15. generic function objectsmethods rechargeable subway pass single-use subway ticket is a subtype of subway ticket top up pay fare lose buy abstract object Multi-methods with type hierarchy
  • 16. generic function objectsmethods rechargeable subway pass single-use subway ticket is a subtype of subway ticket top up pay fare lose buy abstract object Multi-methods with type hierarchy
  • 17. Multi-methods for linear algebra What can I do with/to a thing? find eigenvalues and eigenvectors find singular values find singular values and vectors find eigenvalues generic function objectsmethods general matrix symmetric tridiagonal matrix bidiagonal matrix Methods can take advantage of special matrix structures eigvals eigfact svdvals svdfact Matrix SymTridiagonal Bidiagonal
  • 18. So how does this help us with linear algebra? Multi-method dispatch on special matrix types
  • 19. So how does this help us with linear algebra? Multi-method dispatch on special matrix types
  • 20. So how does this help us with linear algebra? Multi-method dispatch on special matrix types stev!{T<:BlasFloat} calls sgestv dgestv cgestv zgestv and handles workspace memory allocation
  • 21. What’s the big deal about Julia ? Julia isn’t designed for performance using all means necessary. Instead, performance comes from designing a language that is easy for both humans and compilers to understand. ! !
  • 22. from the programmer’s point of view: ! - dynamic language semantics: faster to prototype code - dynamic types: compiler does not hinder experimentation - multiple dispatch allows both methods for general functionality and methods for specialized performance - low-cost software abstractions allow code to retain structure of mathematical abstractions - metaprogramming (with macros) allows code generation: takes software experimentation to the next level with less lines of actual code - flexible syntax, Unicode operators, great community…
  • 23. Pure-­‐Julia  FFT  performance2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 2621440 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 11000 12000 13000 14000 speed(mflops) intel-mkl-dfti in-place intel-mkl-dfti out-of-place fftw3 out-of-place fftw3 in-place fftw3-no-simd out-of-place fftw3-no-simd in-place dfftpack emayer julia bloodworth cross cwplib esrfft double-precision complex, 1d transforms powers of two already  comparable  to  FFTPACK   ! [  actually  was  even  a  bit  better;        some  recent  inlining        regressions  in  Julia  snapshots  ] Steven Johnson, 2014-06 Presented at NAIS Codegen workshop
  • 24. from the compiler’s point of view: ! - dynamic semantics with static analysis: when possible, offload runtime checks to JIT compile stage - multiple dispatch requires function signatures that expose type information - rich type system allows for detailed type inference - inlining passes reduce abstraction cost - automatic code specialization generates many performant methods - macros allow further fine-grained tradeoffs between performance and correctness, e.g. @inbounds, @simd, …