SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
Harmonic Stack for
Speed
2018/3/6
Yung-Yu Chen
https://www.linkedin.com/in/yungyuc/
The World Is Changing
❖ Computing helps human beings to change the world in
an unprecedented pace
❖ What are these?
30 cm in diameter, 1978
3 sizes, 3.5” smallest
Python as Your Computing Platform
❖ Python programming language is the way to go
❖ One language to rule them all
❖ Interactive analysis and visualization
❖ Data preparation and processing
❖ Workflow automation
❖ Distributed processing and parallel computing
❖ Join PyCon TW 2018, 1-2 June: https://tw.pycon.org/2018/
Interactive
❖ http://jupyter.org: run Python everywhere and code it
through browser
❖ https://matplotlib.org: de facto 2D plotting library
❖ https://www.vtk.org: versatile 3D visualization toolbox
❖ https://www.paraview.org: if you only want a
frontend
Data Manipulation
❖ http://pandas.pydata.org: de facto tool for data
analytics
❖ http://www.pytables.org: HDF5 hierarchical data
access
❖ http://unidata.github.io/netcdf4-python/: netCDF, yet
another data storage based on HDF5
Workflow Automation
❖ https://docs.python.org/3/library/argparse.html:
standard command-line argument processing
❖ https://github.com/saltstack/salt: cloud-oriented
automation for management and configuration
❖ AWS, GCE, Azure all offer SDK for Python
Concurrency
❖ https://docs.python.org/3/library/asyncio.html
❖ support native asynchronous constructs
❖ https://docs.python.org/3/library/multiprocessing.html
❖ parallel computing and distributed processing using multiple
processes
❖ http://zeromq.org/bindings:python
❖ socket communication
❖ http://pythonhosted.org/mpi4py/
❖ use MPI in Python
The Only Thing That Doesn’t Change, Is Change
❖ Way too many options for computing
❖ What an engineer should learn?
❖ Yes, I know, Python. But it’s all the tools with Python,
and not Python alone, right?
❖ Can we find something so fundamental that doesn’t
change?
Machine Code
❖ Computer can only execute machine code
❖ But it looks hard.
❖ And it is really hard.
_main:
0000000100001c80 pushq %rbp
0000000100001c81 movq %rsp, %rbp
0000000100001c84 subq $0x60, %rsp
0000000100001c88 leaq 0x2cd(%rip), %rax
0000000100001c8f movl $0x0, -0x4(%rbp)
0000000100001c96 movl %edi, -0x8(%rbp)
0000000100001c99 movq %rsi, -0x10(%rbp)
0000000100001c9d movq %rax, %rdi
0000000100001ca0 callq 0x100001ee8
...
C++: Compromise
❖ First, there was the C programming language
❖ It allows us to write a little bit more friendly code
❖ A compiler takes the code and turn it into assembly,
and it is then turned into machine code
❖ Some geniuses want to make something super powerful
but looks like C
❖ It produces the fastest possible machine code from
machine-friendly, convoluted concepts
Slow for Fast, Fast Is Slow
❖ It takes a lot of time to write code that computers run
fast
❖ C++ -> machine code
❖ Quickly written code takes additional time from
computers to interpret
❖ Python
❖ Ease of use and performance are competing. You cannot
get both.
As Easy as Python, as Fast as C++
❖ Create a new tool that serves both purposes?
❖ You need to re-create two whole eco-systems that
develop for 20-30 years
❖ Doesn’t sound very realistic, does it?
❖ How about using C++ for what needs speed, and
Python for everything else? Yes if we have a way to
bridge them!
pybind11
❖ C++, born in 1985 (development since 1979)
❖ ISO standard: C++98, 03, 11, 14, 17
❖ Python, born in 1991
❖ Community maintained
❖ C++11/14/17(/20) is referred to as modern C++ and usually just “C+
+11”
❖ C++ is notoriously hard, but modern C++ starts to make sense
❖ pybind11 is a tool allowing us to use exclusively modern C++ with
Python
Wrapping Tools for Python Abound
❖ So many software packages provide Python API
❖ pybind11, boost.python, Cython, ctypes, swig, etc.
❖ Python C API
Multi-Language Systems
❖ Recall the purpose: quickly make fast software
❖ Know very well the system fundamentals
❖ It’s always the key to a good software system
❖ In C++: core data structure and performance hotspots
❖ In Python: workflow and customization
Things to Learn
❖ Master your problem domain: mathematics and
mechanics
❖ Computer architecture
❖ Numerical analysis
❖ Practice Python and then C++ for 10 years
Mathematics and Mechanics
❖ Calculus
❖ Linear algebra
❖ Vector analysis
❖ Thermodynamics
❖ Continuum mechanics: solids and fluids
❖ Materials and chemistry
Computer Architecture
❖ Abstract description for how silicon is made for
computing
❖ What runs fast and what runs slow, and why
❖ How do you code to make the best use of the hardware
Numerical Analysis
❖ Turn mathematics into code; the mathematics describes
the physics
❖ Interpolation
❖ Equation solving
❖ Linear systems
❖ Optimization
How to Learn Python
❖ Python should be the first programming language to
learn because it’s easy to use
❖ Edit a text file and run it
❖ Open a browser and run it
print("hello, world") $ python3 hello.py
hello, world
Step 1: Install Runtime
❖ https://www.anaconda.com/download/
❖ Anaconda contains Python and a lot of useful software
packages.
❖ When one starts, it’s even difficult to find and install
software, but Anaconda solves the problem
❖ Use command line as much as possible
❖ If you can, use Linux (Ubuntu) or mac osx, which give you a
powerful command-line shell. Windows 10 professional has
one too, but not as popular as the Unixes.
Step 2: Interact
Programmers try and error and then CPR:
copy-paste-replace
Highly unlikely to get things right the
first time
Step 3: Review and Rewrite
❖ Continuously change the code
❖ Automatic testing is necessary
❖ No one can fully understand 10,000 lines of
code and make sure it’s right
❖ Architect the system
❖ Develop features piece by piece
❖ Connect components
❖ Reorganize structure to make it bigger
solvcon
!"" __init__.py
!"" anchor.py
!"" batch.py
!"" batch_torque.py
!"" block.py
!"" boundcond.py
!"" case.py
!"" case_core.py
!"" cloud.py
!"" cmdutil.py
!"" command.py
!"" conf.py
!"" connection.py
!"" dependency.py
!"" domain.py
!"" exception.py
!"" gendata.py
!"" helper.py
!"" hook.py
!"" io
#   !"" __init__.py
#   $"" ...
!"" mpy.py
!"" mthread.py
!"" parcel
#   !"" __init__.py
#   $"" ...
!"" rpc.py
!"" scuda.py
!"" solver.py
!"" testing.py
$"" ...
How to Learn C++
❖ Never starts with C++
❖ Benchmark first
❖ Use C++ when you need to control from byte to byte
❖ Keep in mind the differences between Python and C++
❖ Python function calls are 10x-100x slower than C++
❖ Python determines everything in runtime; C++
determines many things in compile time.
Compilation
Source file A
Construct 1
Construct 2
Source file B
Construct 1
Construct 2
Binary
Construct A.1
Construct B.2
Construct B.1
Construct A.2
…
Compile Runtime
input
data data
output
data data
Binary
Construct A.1
Construct B.2
Construct B.1
Construct A.2
}Pythondoesn’thaveit
Learn by Doing
❖ Incentive is utmost important: Program to solve your
problems
❖ After your 500,000 lines of code, you’ll get it
❖ If you don’t code enough, reading books doesn’t help
Your Job
❖ Make mobile app run faster? No problem
❖ Scale web page higher? You nail it
❖ Increase video game frame rate? Yes
❖ Crunch more data? Absolutely
❖ Make scientific discoveries? That’s what you do
❖ If you can quickly make computers run fast, jobs find
you

Mais conteúdo relacionado

Mais procurados

Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Yurii Bychenok
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageGanesh Samarthyam
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3Ram Sekhar
 
Beaker Notebook for Data Exploration
Beaker Notebook for Data ExplorationBeaker Notebook for Data Exploration
Beaker Notebook for Data Explorationscottcrespo
 
GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science Domino Data Lab
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...Sławomir Zborowski
 
Scientific Plotting in Python
Scientific Plotting in PythonScientific Plotting in Python
Scientific Plotting in PythonJack Parmer
 
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programmingExotel
 
Google Go! language
Google Go! languageGoogle Go! language
Google Go! languageAndré Mayer
 
Work Python, play Python~
Work Python, play Python~Work Python, play Python~
Work Python, play Python~Idee Liao
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Pôle Systematic Paris-Region
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in osGenchiLu1
 
Python Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaPython Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaGuy K. Kloss
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Powering tensorflow with big data (apache spark, flink, and beam) dataworks...
Powering tensorflow with big data (apache spark, flink, and beam)   dataworks...Powering tensorflow with big data (apache spark, flink, and beam)   dataworks...
Powering tensorflow with big data (apache spark, flink, and beam) dataworks...Holden Karau
 

Mais procurados (20)

Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Number of Computer Languages = 3
Number of Computer Languages = 3Number of Computer Languages = 3
Number of Computer Languages = 3
 
Beaker Notebook for Data Exploration
Beaker Notebook for Data ExplorationBeaker Notebook for Data Exploration
Beaker Notebook for Data Exploration
 
GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science
 
Programming Basics
Programming BasicsProgramming Basics
Programming Basics
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
 
Does reporting takes lots of time
Does reporting takes lots of timeDoes reporting takes lots of time
Does reporting takes lots of time
 
Scientific Plotting in Python
Scientific Plotting in PythonScientific Plotting in Python
Scientific Plotting in Python
 
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programming
 
Google Go! language
Google Go! languageGoogle Go! language
Google Go! language
 
Work Python, play Python~
Work Python, play Python~Work Python, play Python~
Work Python, play Python~
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Python Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaPython Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation Extravaganza
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Powering tensorflow with big data (apache spark, flink, and beam) dataworks...
Powering tensorflow with big data (apache spark, flink, and beam)   dataworks...Powering tensorflow with big data (apache spark, flink, and beam)   dataworks...
Powering tensorflow with big data (apache spark, flink, and beam) dataworks...
 
OpenNMT
OpenNMTOpenNMT
OpenNMT
 
Python vs c++ ppt
Python vs c++ pptPython vs c++ ppt
Python vs c++ ppt
 

Semelhante a Harmonic Stack for Speed

Your interactive computing
Your interactive computingYour interactive computing
Your interactive computingYung-Yu Chen
 
Engineer Engineering Software
Engineer Engineering SoftwareEngineer Engineering Software
Engineer Engineering SoftwareYung-Yu Chen
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Younggun Kim
 
from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018Chun-Yu Tseng
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For ManagersAtul Shridhar
 
Interconnection Automation For All - Extended - MPS 2023
Interconnection Automation For All - Extended - MPS 2023Interconnection Automation For All - Extended - MPS 2023
Interconnection Automation For All - Extended - MPS 2023Chris Grundemann
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-introIshaq Ali
 
Scaling systems for research computing
Scaling systems for research computingScaling systems for research computing
Scaling systems for research computingThe BioTeam Inc.
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OSri Ambati
 
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...ScyllaDB
 
Streaming 101: Hello World
Streaming 101:  Hello WorldStreaming 101:  Hello World
Streaming 101: Hello WorldJosh Fischer
 
Python in Industry
Python in IndustryPython in Industry
Python in IndustryDharmit Shah
 
Codebits Handivi
Codebits HandiviCodebits Handivi
Codebits Handivicfpinto
 
ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywheressuser06ea42
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonTakeshi Akutsu
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of pythonYung-Yu Chen
 
Ali alshehri c++_comparison between c++&python
Ali alshehri c++_comparison between c++&pythonAli alshehri c++_comparison between c++&python
Ali alshehri c++_comparison between c++&pythonAliAAAlshehri
 
Craftsmanship in Computational Work
Craftsmanship in Computational WorkCraftsmanship in Computational Work
Craftsmanship in Computational WorkYung-Yu Chen
 

Semelhante a Harmonic Stack for Speed (20)

Your interactive computing
Your interactive computingYour interactive computing
Your interactive computing
 
Engineer Engineering Software
Engineer Engineering SoftwareEngineer Engineering Software
Engineer Engineering Software
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015
 
from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
 
Interconnection Automation For All - Extended - MPS 2023
Interconnection Automation For All - Extended - MPS 2023Interconnection Automation For All - Extended - MPS 2023
Interconnection Automation For All - Extended - MPS 2023
 
PySide
PySidePySide
PySide
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Scaling systems for research computing
Scaling systems for research computingScaling systems for research computing
Scaling systems for research computing
 
High Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2OHigh Performance Machine Learning in R with H2O
High Performance Machine Learning in R with H2O
 
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
 
Streaming 101: Hello World
Streaming 101:  Hello WorldStreaming 101:  Hello World
Streaming 101: Hello World
 
Python in Industry
Python in IndustryPython in Industry
Python in Industry
 
Codebits Handivi
Codebits HandiviCodebits Handivi
Codebits Handivi
 
ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywhere
 
On the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of PythonOn the Necessity and Inapplicability of Python
On the Necessity and Inapplicability of Python
 
On the necessity and inapplicability of python
On the necessity and inapplicability of pythonOn the necessity and inapplicability of python
On the necessity and inapplicability of python
 
Ali alshehri c++_comparison between c++&python
Ali alshehri c++_comparison between c++&pythonAli alshehri c++_comparison between c++&python
Ali alshehri c++_comparison between c++&python
 
Craftsmanship in Computational Work
Craftsmanship in Computational WorkCraftsmanship in Computational Work
Craftsmanship in Computational Work
 

Mais de Yung-Yu Chen

Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for SpeedYung-Yu Chen
 
SimpleArray between Python and C++
SimpleArray between Python and C++SimpleArray between Python and C++
SimpleArray between Python and C++Yung-Yu Chen
 
Write code and find a job
Write code and find a jobWrite code and find a job
Write code and find a jobYung-Yu Chen
 
Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Yung-Yu Chen
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from PythonYung-Yu Chen
 
Start Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeStart Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeYung-Yu Chen
 

Mais de Yung-Yu Chen (6)

Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
SimpleArray between Python and C++
SimpleArray between Python and C++SimpleArray between Python and C++
SimpleArray between Python and C++
 
Write code and find a job
Write code and find a jobWrite code and find a job
Write code and find a job
 
Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020Notes about moving from python to c++ py contw 2020
Notes about moving from python to c++ py contw 2020
 
Take advantage of C++ from Python
Take advantage of C++ from PythonTake advantage of C++ from Python
Take advantage of C++ from Python
 
Start Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New RopeStart Wrap Episode 11: A New Rope
Start Wrap Episode 11: A New Rope
 

Último

Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Servicemonikaservice1
 
COST ESTIMATION FOR A RESEARCH PROJECT.pptx
COST ESTIMATION FOR A RESEARCH PROJECT.pptxCOST ESTIMATION FOR A RESEARCH PROJECT.pptx
COST ESTIMATION FOR A RESEARCH PROJECT.pptxFarihaAbdulRasheed
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptxryanrooker
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....muralinath2
 
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flypumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flyPRADYUMMAURYA1
 
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...Monika Rani
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusNazaninKarimi6
 
chemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfchemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfTukamushabaBismark
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑Damini Dixit
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and ClassificationsAreesha Ahmad
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPirithiRaju
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICEayushi9330
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryAlex Henderson
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learninglevieagacer
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.Nitya salvi
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 

Último (20)

Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts ServiceJustdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
Justdial Call Girls In Indirapuram, Ghaziabad, 8800357707 Escorts Service
 
COST ESTIMATION FOR A RESEARCH PROJECT.pptx
COST ESTIMATION FOR A RESEARCH PROJECT.pptxCOST ESTIMATION FOR A RESEARCH PROJECT.pptx
COST ESTIMATION FOR A RESEARCH PROJECT.pptx
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
Human & Veterinary Respiratory Physilogy_DR.E.Muralinath_Associate Professor....
 
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flypumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
 
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...
Vip profile Call Girls In Lonavala 9748763073 For Genuine Sex Service At Just...
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
 
chemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfchemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdf
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 

Harmonic Stack for Speed

  • 1. Harmonic Stack for Speed 2018/3/6 Yung-Yu Chen https://www.linkedin.com/in/yungyuc/
  • 2. The World Is Changing ❖ Computing helps human beings to change the world in an unprecedented pace ❖ What are these? 30 cm in diameter, 1978 3 sizes, 3.5” smallest
  • 3. Python as Your Computing Platform ❖ Python programming language is the way to go ❖ One language to rule them all ❖ Interactive analysis and visualization ❖ Data preparation and processing ❖ Workflow automation ❖ Distributed processing and parallel computing ❖ Join PyCon TW 2018, 1-2 June: https://tw.pycon.org/2018/
  • 4. Interactive ❖ http://jupyter.org: run Python everywhere and code it through browser ❖ https://matplotlib.org: de facto 2D plotting library ❖ https://www.vtk.org: versatile 3D visualization toolbox ❖ https://www.paraview.org: if you only want a frontend
  • 5. Data Manipulation ❖ http://pandas.pydata.org: de facto tool for data analytics ❖ http://www.pytables.org: HDF5 hierarchical data access ❖ http://unidata.github.io/netcdf4-python/: netCDF, yet another data storage based on HDF5
  • 6. Workflow Automation ❖ https://docs.python.org/3/library/argparse.html: standard command-line argument processing ❖ https://github.com/saltstack/salt: cloud-oriented automation for management and configuration ❖ AWS, GCE, Azure all offer SDK for Python
  • 7. Concurrency ❖ https://docs.python.org/3/library/asyncio.html ❖ support native asynchronous constructs ❖ https://docs.python.org/3/library/multiprocessing.html ❖ parallel computing and distributed processing using multiple processes ❖ http://zeromq.org/bindings:python ❖ socket communication ❖ http://pythonhosted.org/mpi4py/ ❖ use MPI in Python
  • 8.
  • 9. The Only Thing That Doesn’t Change, Is Change ❖ Way too many options for computing ❖ What an engineer should learn? ❖ Yes, I know, Python. But it’s all the tools with Python, and not Python alone, right? ❖ Can we find something so fundamental that doesn’t change?
  • 10. Machine Code ❖ Computer can only execute machine code ❖ But it looks hard. ❖ And it is really hard. _main: 0000000100001c80 pushq %rbp 0000000100001c81 movq %rsp, %rbp 0000000100001c84 subq $0x60, %rsp 0000000100001c88 leaq 0x2cd(%rip), %rax 0000000100001c8f movl $0x0, -0x4(%rbp) 0000000100001c96 movl %edi, -0x8(%rbp) 0000000100001c99 movq %rsi, -0x10(%rbp) 0000000100001c9d movq %rax, %rdi 0000000100001ca0 callq 0x100001ee8 ...
  • 11. C++: Compromise ❖ First, there was the C programming language ❖ It allows us to write a little bit more friendly code ❖ A compiler takes the code and turn it into assembly, and it is then turned into machine code ❖ Some geniuses want to make something super powerful but looks like C ❖ It produces the fastest possible machine code from machine-friendly, convoluted concepts
  • 12. Slow for Fast, Fast Is Slow ❖ It takes a lot of time to write code that computers run fast ❖ C++ -> machine code ❖ Quickly written code takes additional time from computers to interpret ❖ Python ❖ Ease of use and performance are competing. You cannot get both.
  • 13. As Easy as Python, as Fast as C++ ❖ Create a new tool that serves both purposes? ❖ You need to re-create two whole eco-systems that develop for 20-30 years ❖ Doesn’t sound very realistic, does it? ❖ How about using C++ for what needs speed, and Python for everything else? Yes if we have a way to bridge them!
  • 14. pybind11 ❖ C++, born in 1985 (development since 1979) ❖ ISO standard: C++98, 03, 11, 14, 17 ❖ Python, born in 1991 ❖ Community maintained ❖ C++11/14/17(/20) is referred to as modern C++ and usually just “C+ +11” ❖ C++ is notoriously hard, but modern C++ starts to make sense ❖ pybind11 is a tool allowing us to use exclusively modern C++ with Python
  • 15. Wrapping Tools for Python Abound ❖ So many software packages provide Python API ❖ pybind11, boost.python, Cython, ctypes, swig, etc. ❖ Python C API
  • 16. Multi-Language Systems ❖ Recall the purpose: quickly make fast software ❖ Know very well the system fundamentals ❖ It’s always the key to a good software system ❖ In C++: core data structure and performance hotspots ❖ In Python: workflow and customization
  • 17. Things to Learn ❖ Master your problem domain: mathematics and mechanics ❖ Computer architecture ❖ Numerical analysis ❖ Practice Python and then C++ for 10 years
  • 18. Mathematics and Mechanics ❖ Calculus ❖ Linear algebra ❖ Vector analysis ❖ Thermodynamics ❖ Continuum mechanics: solids and fluids ❖ Materials and chemistry
  • 19. Computer Architecture ❖ Abstract description for how silicon is made for computing ❖ What runs fast and what runs slow, and why ❖ How do you code to make the best use of the hardware
  • 20. Numerical Analysis ❖ Turn mathematics into code; the mathematics describes the physics ❖ Interpolation ❖ Equation solving ❖ Linear systems ❖ Optimization
  • 21. How to Learn Python ❖ Python should be the first programming language to learn because it’s easy to use ❖ Edit a text file and run it ❖ Open a browser and run it print("hello, world") $ python3 hello.py hello, world
  • 22. Step 1: Install Runtime ❖ https://www.anaconda.com/download/ ❖ Anaconda contains Python and a lot of useful software packages. ❖ When one starts, it’s even difficult to find and install software, but Anaconda solves the problem ❖ Use command line as much as possible ❖ If you can, use Linux (Ubuntu) or mac osx, which give you a powerful command-line shell. Windows 10 professional has one too, but not as popular as the Unixes.
  • 23. Step 2: Interact Programmers try and error and then CPR: copy-paste-replace Highly unlikely to get things right the first time
  • 24. Step 3: Review and Rewrite ❖ Continuously change the code ❖ Automatic testing is necessary ❖ No one can fully understand 10,000 lines of code and make sure it’s right ❖ Architect the system ❖ Develop features piece by piece ❖ Connect components ❖ Reorganize structure to make it bigger solvcon !"" __init__.py !"" anchor.py !"" batch.py !"" batch_torque.py !"" block.py !"" boundcond.py !"" case.py !"" case_core.py !"" cloud.py !"" cmdutil.py !"" command.py !"" conf.py !"" connection.py !"" dependency.py !"" domain.py !"" exception.py !"" gendata.py !"" helper.py !"" hook.py !"" io #   !"" __init__.py #   $"" ... !"" mpy.py !"" mthread.py !"" parcel #   !"" __init__.py #   $"" ... !"" rpc.py !"" scuda.py !"" solver.py !"" testing.py $"" ...
  • 25. How to Learn C++ ❖ Never starts with C++ ❖ Benchmark first ❖ Use C++ when you need to control from byte to byte ❖ Keep in mind the differences between Python and C++ ❖ Python function calls are 10x-100x slower than C++ ❖ Python determines everything in runtime; C++ determines many things in compile time.
  • 26. Compilation Source file A Construct 1 Construct 2 Source file B Construct 1 Construct 2 Binary Construct A.1 Construct B.2 Construct B.1 Construct A.2 … Compile Runtime input data data output data data Binary Construct A.1 Construct B.2 Construct B.1 Construct A.2 }Pythondoesn’thaveit
  • 27. Learn by Doing ❖ Incentive is utmost important: Program to solve your problems ❖ After your 500,000 lines of code, you’ll get it ❖ If you don’t code enough, reading books doesn’t help
  • 28. Your Job ❖ Make mobile app run faster? No problem ❖ Scale web page higher? You nail it ❖ Increase video game frame rate? Yes ❖ Crunch more data? Absolutely ❖ Make scientific discoveries? That’s what you do ❖ If you can quickly make computers run fast, jobs find you