Zurich Julia Users Group - Meeting 2 - 26.06.2014x

Download Report

Transcript Zurich Julia Users Group - Meeting 2 - 26.06.2014x

Zurich Julia Users Group
Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor
26th June 2014
Agenda
• 18:00 – Arrival and warm-up
• Pizzas / drinks
• 18:45 Pre-Session
• Introduction / JuliaCon
• A short overview of the performance of Julia compared to MATLAB and R
(Dominik)
• 19:30 Session 1 on general aspects - comparison with R, Python
etc., and Julia's relation w.r.t. Data Science (Malcolm)
• 20:30 Session 2 one on more specific topics such as Big Data, NoSQL
and parallelization (Malcolm)
JuliaCon – June 26 and27 in Chicago
http://juliacon.org/
The first-ever Julia conference will take place June
26 and 27 (Thursday and Friday) at the University
of Chicago Gleacher Center in Chicago, Illinois.
Expect two days of cutting-edge technical talks, a
chance to rub shoulders with Julia's creators, and
a weekend in a city known for its beautiful
lakefront and world-class architecture.
Julia Resources
The Julia Language
Julia (programming language) - Wikipedia, the free encyclopedia
Julia Documentation — Julia Language 0.2.0 documentation
The Julia Manual — Julia Language 0.2.0 documentation
The Julia Standard Library — Julia Language 0.2.1 documentation
Available Packages — Julia Language 0.2.0 documentation
Noteworthy Differences from other Languages — Julia Language 0.2.1
documentation
Julia Downloads
The Julia Blog
Julia Publications
Using Julia in the classroom
JuliaCon 2014: June 26-27, Chicago, IL.
juliabloggers.com - A Julia Language Blog Aggregator
Learn julia in Y Minutes
julia-dev - Google Groups
julia-users - Google Groups
(99+) julia-stats – Google Groups
(16) julia-opt – Google Groups
Lesezeichen verwalten
Julia - Performance
Compared to MATLAB, R , (and bit to Python)
Julia Compared to MATLAB, R (and Python)
• Functions compared
•
•
•
•
•
•
•
•
•
Recursive Fibonacci
Parse Integer
Array Constructors
Smallest number divisiable by all numbers of a factorial
Numeric vector sort
Slow pi series
Slow pi series, vectorized
Random matrix statistics
Large random number generation and matrix multiplication
Win 7 Pro, 32 bit
Timings in seconds
> 1 = slower than Julia
< 1 = faster than Julia
Win 8.1,64 bit
Compared to Python
Fun With Just-In-Time Compiling: Julia, Python, R and pqR
http://www.juliabloggers.com/fun-with-just-in-time-compiling-julia-python-r-and-pqr/
This problem is calculating the smallest number that is divisible by all of the numbers in a factorial. For
example, for the numbers in 5!, 60 is the smallest number that is divisible by 2, 3, 4 and 5.
function smallestdivisall(n::Int64)
def smallestdivisall(n):
for i = 1:factorial(n)
for i in xrange(1, math.factorial(n)+1):
for j = 1:n
for j in xrange(1, n+1):
if i % j !=0
if i % j != 0:
Python
Julia
break
break
elseif j == n
elif j == n:
return i
return i
Julia is about 3-6 x
end
end
faster than Python
end
but…
end
… it is important to
know of which
Python version we
are talking about!
Julia Benchmark (Table)
C performance = 1.0, smaller is better
Julia Benchmark (Chart)
@timeit – A quick Look at Macros
# using the macro
@timeit fib(25) "fib" "Recursive fibonacci"
# the macro
macro timeit(ex,name,desc,group...)
quote
t = zeros(ntrials)
for i=0:ntrials
e = @elapsed $(esc(ex))
1
if i > 0
# warm up on first iteration
2
t[i] = e
end
end
@output_timings t $name $desc $group
end
end
1. The expression gets evaluated and the elapsed time is
measured an stored in e
2. Skip the first measure because it is always slower
as Julia has to initialise the JIT first
macro output_timings(t,name,desc,group)
quote
(… hided code …)
elseif print_output
@printf "%s,%f\n" $name minimum($t)
end
gc()
end
end
Fast Numeric Computation with Julia
• Devectorize espressions – the opposite to MATLAB
• Merge computations into a single loop
• Write cache-friendly code
• Avoid creating arrays in loops
• Use BLAS
• Use a 64 bit machine
• Julia is faster on Linux and OSX than on Windows
Invitation: NLP++ Community
• NLP++
• A programming language for Natural Language Processing
• Based on C++
• Much easier to learn and understand than C++
• VisualText: An NLP++ IDE
• NLP++ Community (http://dev.nlpcloud.net/)
• Growing the number of NLP++ developers
• Sharing tips & tricks
• Improve our analyzers
• If enough interest exists: New MeetUp Group for NLP++ in Zurich!
Start with Julia
Julia Binaries and IDEs
• Download and install the binaries
• http://julialang.org/downloads/
• Current stable version (May 2014): v0.2.1
• Choose an IDE
(both are available for Linux/OSX/WIN)
• JuliaStudio by forio (the one I am using)
• http://forio.com/products/julia-studio/download/
• Based on Qt
• LightTable
• http://www.lighttable.com/
• Based on the Clojure (JVM)
• A very interesting approach, it’s worth to give it a try
Julia Docs
The Julia Manual:
http://docs.julialang.org/en/release-0.2/manual/
The Julia Standard Library:
http://docs.julialang.org/en/release-0.2/stdlib/
Available Packages:
http://docs.julialang.org/en/release-0.2/packages/packagelist/
Julia Community
Google Groups
•
•
•
•
julia-users
julia-dev
julia-stats
julia-opt
Very friendly and no
question is too basic .
We use GitHub to track our source code and for tracking
and discussing issues and commits. There is also a list of
packages for Julia, many of which are also hosted on and
developed using GitHub.
Let’s Start with Julia
• Vectors, Matrices, Arrays
• Simple Calculations
• Functions
• Devectorization
• Types
http://learnxinyminutes.com/docs/julia/
Where does Julia come from?
The Creators of Julia
Jeff Bezanson
Stefan Karpinski
Viral Shah
Alan Edelman
MIT students and researchers
«Why we created Julia»
Open Source
Easy to install
Speed of C
Macros like Lisp
Mathematical notation
like MATLAB
Dynamism
like Ruby
Easy to learn
Interactive
Linear Algebra
like in MATLAB
String processing
like Perl
Compiled
Linux / OSX / WIN
Keep hackers happy
Statistics like R
Liberal licence (MIT)
Gluing programs together
like in a shell
Some noteworthy features