Skip to content

Commit

Permalink
Restructuring, moved KS demo to 2-numeric-like-matlab.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfgibson committed Oct 20, 2017
1 parent 8d4429e commit 45b8ddd
Show file tree
Hide file tree
Showing 30 changed files with 1,300 additions and 1,814 deletions.
10 changes: 5 additions & 5 deletions 1-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"source": [
"## Julia \n",
"\n",
" * a new open-source scientific programming language\n",
" * does interactive numerics and graphics like Matlab\n",
" * runs as fast as C, Fortran\n",
" * modern, dynamic, high-level, general-purpose like Python\n",
" * new open-source scientific programming language\n",
" * interactive numerics and graphics like Matlab\n",
" * as fast as C, Fortran\n",
" * extensible, dynamic, general-purpose like Python\n",
" * metaprogramming power of LISP\n",
" * open-ended innovation"
" * potential game-changer in scientific computing"
]
},
{
Expand Down
584 changes: 112 additions & 472 deletions 2-numeric-like-matlab.ipynb

Large diffs are not rendered by default.

64 changes: 38 additions & 26 deletions 3-fast-as-C.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,28 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Julia is as fast as C or Fortran\n",
"# Julia is fast"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"## Performance benchmarks, general algorithms\n",
"\n",
"Micro-benchmark codes testing iteration, recursion, matrix operations, and I/O, \n",
"using identical algorithms in 11 languages. Smaller is better. Results normalized so C = 1.\n",
"\n",
"\n",
"## Case study: simulation of the Kuramoto-Sivashinksy equation\n",
"![language benchmarks plot](figs/benchmarks.svg)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Performance benchmark, Kuramoto-Sivashinksy equation\n",
"\n",
"The Kuramoto-Sivashinsky (KS) equation is a nonlinear time-evolving partial differential equation (PDE) on a 1d spatial domain.\n",
"\n",
Expand All @@ -18,18 +36,26 @@
"where $x$ is space, $t$ is time, and subscripts indicate differentiation. We assume a spatial domain $x \\in [0, L_x]$ with periodic boundary conditions and initial condition $u(x,0) = u_0(x)$. \n",
"\n",
"A simulation for $u_0 = \\cos(x) + 0.1 \\sin x/8 + 0.01 \\cos x/32$ and $L_x = 64\\pi$.\n",
"![alternative text](figs/ksdynamics.svg)\n",
"![Kuramoto-Sivashinsky u(x,t)](figs/ksdynamics.svg)\n",
"\n",
"## The benchmark algorithm: KS-CNAB2\n",
"\n",
"We implemented the same numerical integration method for the KS equation in six languages. The method uses finite Fourier expansions to discretize space and semi-implicit finite-differencing to discretize time, specifically the 2nd-order rank-Nicolson/Adams-Bashforth (CNAB2) timestepping formula. All languages use the same FFTW library for the Fourier transforms. \n"
"We implemented the same numerical integration method for the KS equation in six languages. The method uses finite Fourier expansions to discretize space and semi-implicit finite-differencing to discretize time, specifically the 2nd-order Crank-Nicolson/Adams-Bashforth (CNAB2) time-stepping formula. This transforms the above PDE to the following iterated linear algebra problem\n",
"\n",
"\n",
"\\begin{equation*}\n",
"A \\, u^{n+1} = B \\, u^n + \\frac{3 \\Delta t}{2} N^n - \\frac{\\Delta t}{2}N^{n-1}\n",
"\\end{equation*}\n",
"\n",
"where $u^n$ is a vector of Fourier coefficients at time $t = n \\Delta t$, $A$ and $B$ are diagonal matrices related to the linear terms in the PDE, and $N^n$ is the Fourier transform of the nonlinear term $u u_x$ at $t = n \\Delta t$. \n",
"See my [julia-pde-benchmark talk](https://github.com/johnfgibson/julia-pde-benchmark/blob/master/1-Kuramoto-Sivashinksy-benchmark.ipynb) talk for mathematical details. All languages use the same FFTW library for the Fourier transforms."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Benchmark results: execution time versus simulation size $N_x$\n",
"## Benchmark results: execution time versus number of gridpoints $N_x$\n",
"\n",
"![alternate text](figs/cputime_vs_size.svg)\n",
"\n",
Expand Down Expand Up @@ -4673,28 +4699,14 @@
"collapsed": true
},
"source": [
"## Benchmark codes\n",
"## KS-CNAB2 benchmark codes\n",
"\n",
" * [ksbenchmark.py](codes/ksbenchmark.py), Python\n",
" * [ksbenchmark.m](codes/ksbenchmark.m), Matlab\n",
" * [ksbenchmark.jl](codes/ksbenchmark.jl), Julia \n",
" * [ksbenchmark.c](codes/ksbenchmark.c), C\n",
" * [ksbenchmark.cpp](codes/ksbenchmark.cpp), C++ \n",
" * [ksbenchmark.f90](codes/ksbenchmark.f90), Fortran\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"# Julia performance benchmarks\n",
"\n",
"Micro-benchmark codes testing iteration, recursion, matrix operations, and I/O, \n",
"using identical algorithms in 11 languages. Smaller is better. Results normalized so C = 1.\n",
"\n",
"\n",
"![language benchmarks plot](figs/benchmarks.svg)\n"
" * [ksbenchmark.py](ks-codes/ksbenchmark.py), Python\n",
" * [ksbenchmark.m](ks-codes/ksbenchmark.m), Matlab\n",
" * [ksbenchmark.jl](ks-codes/ksbenchmark.jl), Julia \n",
" * [ksbenchmark.c](ks-codes/ksbenchmark.c), C\n",
" * [ksbenchmark.cpp](ks-codes/ksbenchmark.cpp), C++ \n",
" * [ksbenchmark.f90](ks-codes/ksbenchmark.f90), Fortran\n"
]
},
{
Expand Down
281 changes: 151 additions & 130 deletions 4-just-in-time-compilation.ipynb

Large diffs are not rendered by default.

2,127 changes: 971 additions & 1,156 deletions 5-julia-goes-beyond.ipynb

Large diffs are not rendered by default.

48 changes: 23 additions & 25 deletions 6-conclusions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,30 @@
"source": [
"# Conclusions\n",
"\n",
"### Julia \n",
" * well-designed open-source scientific programming language \n",
" * great numeric types, libraries\n",
" * great general-purpose types, libraries\n",
" * modern, dynamic, flexible\n",
" * roughly as fast as compiled C\n",
" * easy learning curve\n",
" * dynamism and metaprogramming make new things possible\n",
" * **solves the two-language problem:** from tinkering to HPC\n",
" \n",
"### *Julia solves the two-language problem*\n",
" * from interactive exploration to high-performance computing\n",
" \n",
"### *Julia opens new doors*\n",
" * exact and high-precision calculations \n",
" * higher-level abstraction of parallelism \n",
" * numerics and general-purpose computing\n",
" * scientific computing and computer science\n",
" \n",
"### *Openness fosters innovation* \n",
"\n",
"\n",
"### Didn't cover\n",
" * [parallel computing](http://docs.julialang.org/en/release-0.5/manual/parallel-computing/)\n",
" * [general-purpose libraries:](http://docs.julialang.org/en/release-0.5/#stdlib) Strings, Sets, Arrays, Tuples, Dicts, Time, Streams, Network, Tasks,...\n",
" * [documentation](http://docs.julialang.org/en/release-0.5/)\n",
" * [installation](http://julialang.org/downloads/)\n",
" * required libraries: LLVM, OpenBLAS, LAPACK, ARPACK, FFTW, GNU arb-size int & float, ...\n",
" * [calling C and Fortran](http://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/)\n",
"#### Didn't cover\n",
" * [installation](http://julialang.org/downloads/), [documentation](http://docs.julialang.org/en/stable/) \n",
" * [Juno](http://junolab.org/) integrated development environment, [Gallium](https://github.com/Keno/Gallium.jl) debugger.\n",
" * [parallel computing](http://docs.julialang.org/en/stable/manual/parallel-computing/)\n",
" * [interoperability](http://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/) with other languages\n",
" * [modules](ocs.julialang.org/en/stable/manual/modules/) and [package manager](http://docs.julialang.org/en/stable/manual/packages/)\n",
" * [documentation](http://docs.julialang.org/en/stable/)\n",
" * [code hosting on git](https://github.com/JuliaLang/juliasource)\n",
" * running Julia on [JuliaBox](https://juliabox.com/) or from command-line\n",
" \n",
"### Acknowledgements\n",
" * Julia community: [language development](https://github.com/JuliaLang/juliasource), [discussion forum](https://discourse.julialang.org)\n",
" * running Julia on [JuliaBox](https://juliabox.com/)\n",
"\n",
"#### Acknowledgements\n",
" * [David Sanders](http://sistemas.fciencias.unam.mx/~dsanders/), Physics, Universidad Nacional Autónoma de México \n",
" * [Andreas Noack](http://andreasnoack.github.io/academiccv.html), CS and AI Lab, MIT\n",
" * [Andreas Noack](http://andreasnoack.github.io/academiccv.html), Julia Computing\n",
" * The Julia team\n",
" * NSF grant #1554149"
]
Expand All @@ -48,9 +46,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.5.0",
"display_name": "Julia 0.6.0",
"language": "julia",
"name": "julia-0.5"
"name": "julia-0.6"
},
"language_info": {
"file_extension": ".jl",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 45b8ddd

Please sign in to comment.