<<

The Julia Language Seminar Talk Francisco Vidal Meca

Languages for Scientific Computing Aachen, January 16, 2014 Why Julia?

Many languages, each one a trade-off Multipurpose language: scientific computing data mining large-scale linear algebra distributed and

"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 high performance Easy syntax Parallelism & Cloud computing Graphs Free and Open source Developed in the MIT Version 1.0 released February 2012

The Julia Language 4 About Julia

Multi-paradigm Homoiconic Dynamic Easy integration with / Multiple-dispatch Just-in-time(JIT) LLVM-based compiler Free and open source Core under MIT license Libraries under GPL, LGPL, BSD Environment under GPL Numerical accuracy

The Julia Language 6 Parallelism and Cloud computing

Key factor in Julia’s design Building blocks for Example distributed computation function TicToc(N) Multiple worker processes tic(); Local nh = @parallel (+) for i=1:N Remote int(randbool()) Different from other end; environments such as MPI s=toc(); println("Num. Heads: $nh ") Built on remote references println("in $s seconds") and remote calls end Simplified with macros, e.g., @paralell

The Julia Language 7 Mathematical functions

Extensive Math function library

Integrates C and Fortran libraries Linear Algebra Random number generation Signal processing String processing

The Julia Language 8 Integration

Calling external functions in C/Fortran Need to be Shared Library Called directly with ccal

Example ccal((:function,"library") ,RetType,InputTypes,Inputs)

julia> t = ccall( (:clock, "libc"), Int32, ()) 2292761

julia> t 2292761

The Julia Language 9 Performance

4 10

3 10

benchmark 2 rand_mat_mul 10 rand_mat_stat pi_sum printfd 101 mandel quicksort fib parse_int 100

10-1

Julia Fortran Go JavaScript Python RMathematica Matlab Octave

Figure: Benchmark times [1] relative to C 1.

1Smaller is better, C performance = 1.0 The Julia Language 10 Plotting with Julia

inset 1 1 0.5

0

0.5 −0.5

−1 Not in the core Julia System 0 1 2 3 4 5 6 0

Add-on package "Winston" −0.5

−1 Julia and

0 1 2 3 4 5 6

Figure: Error bars and plot composition.

The Julia Language 11 title!

1 title

0.5 i

Θ 0

−0.5

−1

0 2 4 6 8 2 x label Σx i

100 top 10 100 1000 a points b points 1 1 80 slope

0.5 1/2 60 right 0 0 left 40

−0.5 −1/2

20

−1 −1

3 4 5 6 7 8 9 0 bottom 0 20 40 60 80 100 The Julia Language 12 Developer community

External packages Active community Built in package manager Mailing list IJulia GitHub Browser-based graphical Youtube channel “JuliaLanguage” IPython and Julia StackOverflow community Users meetup (today in E.g.: Prof. Edelman’s San Francisco Bay Area) notes for the Parallel ... Computing class

The Julia Language 13 Conclusion

Uses Multi-purpose language BigFloats, Combinatorics, High level and easy syntax Statistics High performance LAPACK for Linear algebra Graphs SuiteSparse for Sparse Parallelism & Cloud factorizations computing Provides BLAS functions Integration wrappers Free and Open Source Signal processing, FFT functions from FFTW

The Julia Language 15 Conclusion

Multi-purpose language Example High level and easy syntax function mandel(z) High performance c = z maxiter = 80 Graphs for n = 1:maxiter if abs(z) > 2 return n-1 Parallelism & Cloud end z = z^2 + c computing end return maxiter Integration end Free and Open Source

The Julia Language 15 Conclusion

Multi-purpose language

4 High level and easy syntax 10

3 High performance 10 benchmark 2 rand_mat_mul 10 rand_mat_stat pi_sum Graphs printfd 101 mandel quicksort fib parse_int Parallelism & Cloud 100

computing 10-1 Julia Fortran Go JavaScript Python RMathematica Matlab Octave Integration Free and Open Source

The Julia Language 15 Conclusion

Multi-purpose language High level and easy syntax High performance Graphs Parallelism & Cloud computing Integration Free and Open Source

The Julia Language 15 Conclusion

Multi-purpose language High level and easy syntax Example High performance dzeros(100,100,10) Graphs dones(100,100,10) Parallelism & Cloud drand(100,100,10) computing dfill(x, 100,100,10) Integration Free and Open Source

The Julia Language 15 Conclusion

Multi-purpose language High level and easy syntax Easy integration with High performance C Graphs Fortran Parallelism & Cloud Shell computing Pipes Integration Free and Open Source

The Julia Language 15 So. . . what is Julia?

“Julia has the performance of a statically compiled language while providing the interactive, dynamic experience and productivity that scientists have come to expect. ... Julia is a game changer for high performance computing." [4]

Try Julia! Online Julia + tutorial http://forio.com/julia/repl/

The Julia Language 16 References

Leah Hanson Shah, V.; Edelman, A.; Karpinski, S.; Bezanson, J.; Kepner, J The Julia Language (Last accessed on Jan 2014) http://julialang.org

Leah Hanson Learn Julia in Y minutes (Last accessed on Nov 2013) http://learnxinyminutes.com/docs/julia/

Douglas Eadline Parallel 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, J Novel algebras for advanced analytics in Julia High Performance Extreme Computing Conference (HPEC), 2013

The Julia Language 17 Demo and examples

See how Julia works: 1 @parallel example and number of processors 2 Alternating harmonic series approximation 3 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 Julia Not 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 GitHub Julia Debugging Procedures using GDB 3 Prototype interactive debugger “Debug” as external package 4

2http://docs.julialang.org/en/latest/manual/faq 3https://gist.github.com/staticfloat/6188418 4https://github.com/toivoh/Debug.jl The Julia Language 21