- Presenters: Tim Holy, Shuhei Kadowaki
- YouTube link: https://www.youtube.com/watch?v=wXRMwJdEjX4
- pretalx link: https://pretalx.com/juliacon2021/talk/VY9UVX/
Julia holds immense promise for a composable package ecosystem. Potential obstacles to achieving this promise include missing methods for unanticipated types, unwitting type-piracy, poor performance due to inference failures, method ambiguities, and latency due to long compilation times and/or invalidation of previously-compiled code.
This workshop will tutor developers on the use of some of the tools available for improving package quality and reducing latency. We will begin by summarizing the factors that influence dispatch, inference, latency, and invalidation, and how monitoring inference provides a framework for detecting problems before or as they arise. We will then tutor attendees in the use of tools like MethodAnalysis, JET, Cthulhu, and SnoopCompile to discover, analyze, and fix detected problems in package implementation. We will also show how in addition to improving robustness, such steps can often streamline design and reduce latency.
This workshop is aimed at experienced Julia developers.
For this workshop, we recommend you use Julia v1.7 or higher. You can download a prebuilt v1.7 binary or an nightly build. You can also use Julia built from the latest source.
If you've installed an appropriate Julia version, clone this repository and install the required packages with the following commands:
julia> pwd() # check whether you're in this folder (if not, navigate here with `cd`)
"/home/user/path/to/juliacon2021-workshop-pkgdev"
julia> using Pkg
julia> Pkg.activate(@__DIR__)
julia> Pkg.instantiate()
If you have any errors involving PyPlot or PyCall, try this:
julia> ENV["PYTHON"]=""
julia> Pkg.build("PyCall")
Now you can run the workshop notebooks with:
julia> using IJulia
# # install Jupyter kernel if not exist
# julia> IJulia.installkernel(KERNEL_NAME)
julia> IJulia.notebook(; dir=@__DIR__)
- (Tim, 25min) Introduction: a tutorial on Julia internals (methods, types, MethodInstances & specialization, dispatch, backedges, invalidation, precompilation). Includes a few demos of MethodAnalysis.jl
- Q&A
- (Shuhei, 45min) JET.jl workshop: Explanations of the basic ideas of JET, and demos of its usages
- Q&A
- (Tim, 30min) SnoopCompile workshop 1: inference-profiling, profile-guided despecialization, precompilation
- Q&A
- (Tim, 15min): Lowered & typed code
- (Shuhei, 30min) Cthulhu.jl workshop: Gives an overview of Cthulhu and shows how we can use it to understand behaviors of Julia compiler
- (Tim, 15min): SnoopCompile & Cthulhu integration