Introduction to Julia: Why are we doing this to you? (Fall 2015) Steven G. Johnson, MIT Applied Math MIT classes 18.303, 18.06, 18.085, 18.337.

Slides:



Advertisements
Similar presentations
Guy Griffiths. General purpose interpreted programming language Widely used by scientists and programmers of all stripes Supported by many 3 rd -party.
Advertisements

MatLab API in C++ Christopher Dabney. Purpose MatLab … MatLab … is an interpreted scripting language is an interpreted scripting language conversion to.
Python for Science Shane Grigsby. What is python? Why python? Interpreted, object oriented language Free and open source Focus is on readability Fast.
Engineering Computation using MATLAB
Zurich Julia Users Group Meetup Consultants – Meeting Room 2nd Floor 26th June 2014.
R Mohammed Wahaj. What is R R is a programming language which is geared towards using a statistical approach and graphics Statisticians and data miners.
MATLAB Presented By: Nathalie Tacconi Presented By: Nathalie Tacconi Originally Prepared By: Sheridan Saint-Michel Originally Prepared By: Sheridan Saint-Michel.
Script Languages in Science CCOM Student Seminar Series Kurt Schwehr 12-Nov-2008.
Language Issues Misunderstimated? Sublimable? Hopefuller? "I know how hard it is for you to put food on your family.” "I know the human being and fish.
Python plotting for lab folk Only the stuff you need to know to make publishable figures of your data. For all else: ask Sourish.
Alan Edelman, Jeff Bezanson Viral Shah, Stefan Karpinski Jeremy Kepner and the vibrant open-source community Computer Science & AI Laboratories Novel Algebras.
What is R By: Wase Siddiqui. Introduction R is a programming language which is used for statistical computing and graphics. “R is a language and environment.
© 2004 The MathWorks, Inc. 1 MATLAB for C/C++ Programmers Support your C/C++ development using MATLAB’s prebuilt graphics functions and trusted numerics.
Introduction to FORTRAN
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
Dr. Chris Musselle – Consultant R Meets Julia Dr Chris Musselle.
Joshua Alexander University of Oklahoma – IT/OSCER ACI-REF Virtual Residency Workshop Monday June 1, 2015 Deploying Community Codes.
Introduction to MATLAB adapted from Dr. Rolf Lakaemper.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
An innovative learning model for computation in first year mathematics Birgit Loch Department of Mathematics and Computing, USQ Elliot Tonkes CS Energy,
Company Overview for GDF Suez December 29, Enthought’s Business Enthought provides products and consulting services for scientific software solutions.
CSC 589 Introduction to Computer Vision Lecture 2 linear filtering Instructor: Bei Xiao Thursday, January 15th Salvador Dali “Gala Contemplating the Mediterranean.
Scientific Computing Beyond Matlab Nov 19, 2012 Jason Su.
Computational Physics Introduction 3/30/11. Goals  Calculate solutions to physics problems  All physics problems can be formulated mathematically. 
Scientific Computing with NumPy & SciPy NumPy Installation and Documentation  Not much on the home page—don’t buy the guide, it’s.
Alan Edelman, Jeff Bezanson Viral Shah, Stefan Karpinski and the vibrant open-source community Computer Science & AI Laboratories
Eng Ship Structures 1 Introduction to Matlab.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course.
Alan Edelman Jeff Bezanson, Viral Shah, Stefan Karpinski and the vibrant community Computer Science & AI Laboratories.
Alan Edelman, Jeff Bezanson Viral Shah, Stefan Karpinski students in and the greater community Computer Science & AI Laboratories.
Slide 1 The “New” matrix statistics of Random Matrix Theory and the Julia Programming Language Alan Edelman Mathematics Computer Science & AI Labs IMS/ASA.
What is Electrical Engineering?
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Introduction to MATLAB 7 MATLAB Programming for Engineer Hassan Migdadi Spring 2013.
Dan Goodman & Romain Brette Ecole Normale Supérieure Projet Odyssée
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Alan Edelman Mathematics Computer Science & AI Laboratories June 9, 2014 Jeff Bezanson, Stefan Karpinski, Viral Shah and may collaborators worldwide Try.
CIS 601 Fall 2003 Introduction to MATLAB Longin Jan Latecki Based on the lectures of Rolf Lakaemper and David Young.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
COMP 4332 Tutorial 1 Feb 16 WANG YUE Tutorial Overview & Learning Python.
Jeff Howbert Introduction to Machine Learning Winter Machine Learning MATLAB Essentials.
Python & NetworkX Youn-Hee Han
Improving performance Matlab’s a pig. Outline Announcements: –Homework I: Solutions on web –Homework II: on web--due Wed. Homework I Performance Issues.
CIS 595 MATLAB First Impressions. MATLAB This introduction will give Some basic ideas Main advantages and drawbacks compared to other languages.
“Moh’d Sami” AshhabSummer 2008University of Jordan MATLAB By (Mohammed Sami) Ashhab University of Jordan Summer 2008.
PYTHON FOR HIGH PERFORMANCE COMPUTING. OUTLINE  Compiling for performance  Native ways for performance  Generator  Examples.
Introduction. News you can use Hardware –Multicore chips (2009: mostly 2 cores and 4 cores, but doubling) (cores=processors) –Servers (often.
Python – It's great By J J M Kilner. Introduction to Python.
Python Scripting for Computational Science CPS 5401 Fall 2014 Shirley Moore, Instructor October 6,
S5.40. Module Structure 30% practical tests / 70% written exam 3h lectures / week (except reading week) 3 x 2h of computer labs (solving problems practicing.
Bradley, Barbare, Wagner
mathemaTcl – a collection of mathematical extensions
PH2150 Scientific Computing Skills
IBM Predictive Analytics Virtual Users’ Group Meeting March 30, 2016
Matlab.
CSC391/691 Intro to OpenCV Dr. Rongzhong Li Fall 2016
PH2150 Scientific Computing Skills
Introduction to MATLAB
Python for Scientific Computing
Brief Intro to Python for Statistics
Communication and Coding Theory Lab(CS491)
Scientific Python Introduction
Simulation And Modeling
Introduction to Matlab
Python for Data Analysis
Presentation transcript:

Introduction to Julia: Why are we doing this to you? (Fall 2015) Steven G. Johnson, MIT Applied Math MIT classes , 18.06, ,

What language for teaching scientific computing? For the most part, these are not hard-core programming courses, and we only need little “throw-away” scripts and toy numerical experiments. Almost any high-level, interactive (dynamic) language with easy facilities for linear algebra (Ax=b, Ax=λx), plotting, mathematical functions, and working with large arrays of data would be fine. And there are lots of choices…

Lots of choices for interactive math… [ image: Viral Shah ]

Just pick the most popular? Matlab or Python or R? We feel guilty pushing a language on you that we no longer want to use ourselves. Traditional HL computing languages hit a performance wall in “real” work … eventually force you to C, Cython, …

A new programming language? julialang.org [begun 2009, “0.1” in 2013, ~24k commits, currently nearing “0.4” release ] Alan Edelman Jeff Bezanson Viral Shah Stefan Karpinski [ 24+ developers with 100+ commits, 590 “published” packages, 2 nd JuliaCon in 2015 ] [ MIT ] As high-level and interactive as Matlab or Python+IPython, as general-purpose as Python, as useful for technical work as Matlab or Python+SciPy, but as fast as C.

Performance on synthetic benchmarks [ loops, recursion, etc., implemented in most straightforward style ] (normalized so that C speed = 1)

Special Functions in Julia Special functions s(x): classic case that cannot be vectorized well … switch between various polynomials depending on x Many of Julia’s special functions come from the usual C/Fortran libraries, but some are written in pure Julia code. Pure Julia erfinv(x) [ = erf –1 (x) ] 3–4× faster than Matlab’s and 2–3× faster than SciPy’s (Fortran Cephes). Pure Julia polygamma(m, z) [ = (m+1) th derivative of the ln Γ function ] ~ 2× faster than SciPy’s (C/Fortran) for real z … and unlike SciPy’s, same code supports complex argument z Julia code can actually be faster than typical “optimized” C/Fortran code, by using techniques [metaprogramming/code generation] that are hard in a low- level language.

Pure-Julia FFT performance already comparable to FFTPACK [ probably some tweaks to inlining will make it better ] FFTW 1.0-like code generation + recursion in Julia ~ 1/3 lines of code compared to FFTPACK, more functionality (FFTW, MKL: “unfair” factor of ~2 from manual SIMD) Julia FFTPACK FFTW w/o SIMD

Generating Vandermonde matrices given x = [α 1, α 2, …], generate: NumPy ( numpy.vander ): [follow links] Python code …wraps C code Python code C code … wraps generated C codegenerated C code type-generic at high-level, but low level limited to small set of types. Writing fast code “in” Python or Matlab = mining the standard library for pre-written functions (implemented in C or Fortran). If the problem doesn’t “vectorize” into built-in functions, if you have to write your own inner loops … sucks for you.

Generating Vandermonde matrices given x = [α 1, α 2, …], generate: NumPy ( numpy.vander ): [follow links] Python code …wraps C code Python code C code … wraps generated C codegenerated C code type-generic at high-level, but low level limited to small set of types. function vander{T}(x::AbstractVector{T}, n=length(x)) m = length(x) V = Array(T, m, n) for j = 1:m V[j,1] = one(x[j]) end for i = 2:n for j = 1:m V[j,i] = x[j] * V[j,i-1] end return V end Julia (type-generic code):

Generating Vandermonde matrices function vander{T}(x::AbstractVector{T}, n=length(x)) m = length(x) V = Array(T, m, n) for j = 1:m V[j,1] = one(x[j]) end for i = 2:n for j = 1:m V[j,i] = x[j] * V[j,i-1] end return V end

[ ipython.org ] via IPython/Jupyter: Modern multimedia interactive notebooks mixing code, results, graphics, rich text, equations, interaction “IJulia” Julia leverages Python… Directly call Python libraries (PyCall package), e.g. to plot with Matplotlib (PyPlot package)

goto live IJulia notebook demo… Go to juliabox.org for install-free IJulia on the Amazon cloud See also julialang.org for more tutorial materials…