Summary and Setup
This is a lesson on “Efficient Computing with Julia”.
Synopsis
The Julia programming language is getting more and more popular as a language for data analysis, modelling and optimization problems. It promises the ease of Python or R with a run-time efficiency closer to C or Fortran. Julia also is a more modern language with a packaging ecosystem that makes packages easier to install and maintain. A programmer that is familiar with Python, R or Matlab should have little problem getting up to speed with the basics of Julia. However, to really obtain the promised near native run-time efficiency is a different skill altogether.
This workshop aims to get research software engineers (experienced in another programming language) from their first steps in Julia to become aware of all the major techniques and pitfalls when it comes to writing performant Julia.
We will work hands-on with real-world examples to explore concepts in the Julia language, focussing on differences with other languages. After the first day, you will be familiar with the basic constructs of the language, some popular libraries, and its package manager, including unit testing and documentation.
The second day we will dive deeper in making Julia code fast to run. We’ll see how to benchmark and profile code, and find out what is fast and slow. This means getting to grips with Julia’s type system and its compilation strategy. We will close the day with parallel programming and using the GPU to make our code even faster.
Syllabus
- Basics of Julia: build a model of our solar system
- operations, control flow, functions
-
Unitful
quantities,Dataframes
and plotting withMakie
- types and dispatch
- arrays and broadcasting
- Package development: solving Cubic equations
- working with the REPL, and
Pkg
- best practices with
BestieTemplate
- testing with
Test
, documentation withDocumenter
- working with the REPL, and
- Faster code: a logistic population model
-
BenchmarkTools
andProfileView
(flame graphs) - Optimisation techniques
- The type system in more depth
- Type stability
- Parallel programming:
Threads
and GPU programming (with Julia fractals)
-
Who
This workshop is aimed at scientists and research engineers who are already familiar with another language like Python, Matlab or R. The basics of Julia will be introduced, but it is essential that participants are familiar with programming concepts and are comfortable working with a programming editor and command-line interfaces.
Participants should bring a decent laptop (no chrome book) with the latest version of Julia installed and working (instructions will be provided after registration).
Setup
This workshop is always taught using the latest release version of Julia. We use VS Code as our main environment. Depending on your experience, setting up your environment should take around 30min - 1h. We encourage you to also spend 1-2h exploring the Julia Manual.
Equipment
You need a decent laptop with priviliges to install software. Julia is a compiled language and compiling can be demanding on your CPU. Specifically, something like a Chromebook or similar will definitely not do.
Install Dependencies
Prepare the courses package environment. Create a directory that you will work in:
Press ]
to enter package mode:
JULIA
(@v1.11) pkg> activate .
(EfficientJulia) pkg> add GLMakie DataFrames BenchmarkTools GeometryBasics IterTools Revise Unitful StaticArrays Images FileIO
This may take a while (which is why you need to do it in advance).
VS Code
Install VS Code. VS Code is the de-facto standard IDE for Julia. Within VS Code, install the Julia language plugin. Press the puzzle-piece icon in the toolbar and search for Julia, the top result should be the official extension.
Prepare
If you have time, explore the Julia Manual. This is not mandatory, but you will learn a lot more in the workshop if you are prepared. Skim through from “Getting Started” until (including) “Methods”, and spend one or two hours trying out things that you find interesting, while enjoying a nice cup of your favourite hot beverage.