The Julia Language Seminar Talk Francisco Vidal Meca Languages for Scientific Computing Aachen, January 16, 2014
The Julia LanguageSeminar Talk
Francisco Vidal Meca
Languages for Scientific Computing Aachen, January 16, 2014
Why Julia?
Many languages, each one a trade-offMultipurpose language:
scientific computingmachine learningdata mininglarge-scale linear algebradistributed and parallel computing
"In short, because we are greedy. (We) want to have it all." [1]
The Julia Language 3
Julia and Scientific Computing
Julia is "A fresh approach to technical computing"
High level and highperformanceEasy syntaxParallelism & CloudcomputingGraphsFree and Open sourceDeveloped in the MITVersion 1.0 releasedFebruary 2012
The Julia Language 4
About Julia
Multi-paradigmHomoiconicDynamicEasy integration with C/FortranMultiple-dispatchJust-in-time(JIT) LLVM-based compilerFree and open source
Core under MIT licenseLibraries under GPL, LGPL, BSDEnvironment under GPL
Numerical accuracy
The Julia Language 6
Parallelism and Cloud computing
Key factor in Julia’s designBuilding blocks fordistributed computationMultiple worker processes
LocalRemote
Different from otherenvironments such as MPI
Built on remote referencesand remote callsSimplified with macros,e.g., @paralell
Examplefunction TicToc(N)
tic();nh = @parallel (+) for i=1:N
int(randbool())end;s=toc();println("Num. Heads: $nh ")println("in $s seconds")
end
The Julia Language 7
Mathematical functions
Extensive Math function library
Integrates C and Fortran librariesLinear AlgebraRandom number generationSignal processingString processing
The Julia Language 8
Integration
Calling external functions in C/FortranNeed to be Shared LibraryCalled directly with ccal
Exampleccal((:function,"library") ,RetType,InputTypes,Inputs)
julia> t = ccall( (:clock, "libc"), Int32, ())2292761
julia> t2292761
The Julia Language 9
Performance
101
102
100
10-1
104
103
MatlabGo RMathematicaPythonFortran OctaveJavaScriptJulia
benchmark
fib
mandel
pi_sum
rand_mat_mul
rand_mat_stat
printfd
quicksort
parse_int
Figure: Benchmark times [1] relative to C 1.
1Smaller is better, C performance = 1.0
The Julia Language 10
Plotting with Julia
Not in the core Julia System
Add-on package "Winston"
Julia and GNUplot
inset
−1
−0.5
0
0.5
1
0 1 2 3 4 5 6
−1
−0.5
0
0.5
1
0 1 2 3 4 5 6
Figure: Error bars and plotcomposition.
The Julia Language 11
title!
−1
−0.5
0
0.5
1
Θi
0 2 4 6 8Σx2i
a points
b points
slope
0
20
40
60
80
100
0 20 40 60 80 100
title
x label
−1
−1/2
0
1/2
1
right
10 100 1000top
−1
−0.5
0
0.5
1
left
3 4 5 6 7 8 9bottom
The Julia Language 12
Developer community
External packagesBuilt in package managerIJulia
Browser-based graphicalnotebook interfaceIPython and JuliacommunityE.g.: Prof. Edelman’snotes for the ParallelComputing class
Active communityMailing listGitHubYoutube channel“JuliaLanguage”StackOverflowUsers meetup (today inSan Francisco Bay Area). . .
The Julia Language 13
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
UsesBigFloats, Combinatorics,StatisticsLAPACK for Linear algebraSuiteSparse for SparsefactorizationsProvides BLAS functionswrappersSignal processing, FFTfunctions from FFTW
The Julia Language 15
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
Example
function mandel(z)c = zmaxiter = 80for n = 1:maxiter
if abs(z) > 2return n-1
endz = z^2 + c
endreturn maxiter
end
The Julia Language 15
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
101
102
100
10-1
104
103
MatlabGo RMathematicaPythonFortran OctaveJavaScriptJulia
benchmark
fib
mandel
pi_sum
rand_mat_mul
rand_mat_stat
printfd
quicksort
parse_int
The Julia Language 15
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
The Julia Language 15
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
Example
dzeros(100,100,10)dones(100,100,10)drand(100,100,10)dfill(x, 100,100,10)
The Julia Language 15
Conclusion
Multi-purpose languageHigh level and easy syntaxHigh performanceGraphsParallelism & CloudcomputingIntegrationFree and Open Source
Easy integration withCFortranShellPipes
The Julia Language 15
So. . . what is Julia?
“Julia has the performance of a statically compiled languagewhile providing the interactive, dynamic experience andproductivity that scientists have come to expect....Julia is a game changer for high performance computing." [4]
Try Julia! Online Julia + tutorialhttp://forio.com/julia/repl/
The Julia Language 16
References
Leah HansonShah, V.; Edelman, A.; Karpinski, S.; Bezanson, J.; Kepner, JThe Julia Language (Last accessed on Jan 2014)http://julialang.org
Leah HansonLearn Julia in Y minutes (Last accessed on Nov 2013)http://learnxinyminutes.com/docs/julia/
Douglas EadlineParallel Julia (Last accessed on Dec 2013)HPC - ADMIN Magazine http://www.admin-magazine.com/HPC/Articles/Parallel-Julia-Jumping-Right-In
Shah, V.; Edelman, A.; Karpinski, S.; Bezanson, J.; Kepner, JNovel algebras for advanced analytics in JuliaHigh Performance Extreme Computing Conference (HPEC), 2013
The Julia Language 17
Demo and examples
See how Julia works:1 @parallel example and number of processors2 Alternating harmonic series approximation3 Plots
Feel free to ask!
The Julia Language 18
Performance (2)
Figure: Benchmark times [1] relative to C.
The Julia Language 19
IJulia
Figure: IJulia Screenshot
The Julia Language 20
Debugging in Julia
Debugging is possible in JuliaNot integrated (yet) into the core language
Only guidelines to debug Julia’s C code in the FAQ section 2
Found some documentation about it in GitHubJulia Debugging Procedures using GDB 3
Prototype interactive debugger “Debug” as external package 4
2http://docs.julialang.org/en/latest/manual/faq3https://gist.github.com/staticfloat/61884184https://github.com/toivoh/Debug.jl
The Julia Language 21