Skip to content

Getting started

Setup the repo

If you haven't already installed julia, you should first checkout the julia install section.

First time setup

Clone the git repo:

bash
git clone ssh://git@gitlab.cern.ch:7999/tla-atlas-run3/BjetTLA.jl.git

Then, move inside the repo directory and start julia with the --project flag:

bash
cd BjetTLA.jl
julia --project

This will launch a Julia REPL (Read-Eval-Print Loop) activating the project in current directory, defined by the Project.toml file.

At Julia REPL prompt, press ] once to enter Pkg mode and run:

julia
(@BjetTLA) pkg> instantiate

This will download and precompile all the dependencies needed by this project. It might take a while. Once done, you can exit the Pkg mode pressing the ←Backspace button.

Now you should be able to load and use the BjetTLA functions with e.g.:

julia
julia> using BjetTLA
julia> tree = load_trees(...)

On every session

On every new terminal, to run the code in the REPL, the flag --project has to be used when starting julia from the repo's root directory (see above).

When running instead a jupyter notebook, it's possible to activate the project with:

julia
using Pkg
Pkg.activate("..")  # Assuming we are in /notebooks the folder
using BjetTLA

Julia install

You can get a julia installation via the juliaup installer. This will download and setup the binaries needed for julia. On LXPLUS machines, or more in general, on linux or mac you just have to run

curl -fsSL https://install.julialang.org | sh

!!!note This will create the folder ~/.julia and setup the installation at that location. Juliaup will also edit your ~/.bashrc and ~/.bash_profile adding the */bin/julia executable in your PATH.

CERN LXPLUS instruction

By default, Julia caches compiled binary under ~/.julia/ folder. This becomes a problem for the very limited AFS home directory space. To change this, add to your ~/.bashrc file:

bash
export JULIA_DEPOT_PATH=/eos/home-<u>/<usr>/.julia/

Remember to source the ~/.bashrc again or re-login the session for the changes to take effect.

Note

Julia is also available via LCG, but using the central installation can be sometimes limiting (e.g. installing custom jupyter kernels) and it's not always up to date.

Setting up jupyter notebooks

With IJulia we have jupyter kernels running julia-language backend. Via the Pkg manager you just have to execute:

julia
(@v1.10) pkg> add IJulia

Now, when starting a jupyter session, you should see the possibility to start julia notebooks. You can also add custom kernels e.g. for running with multi-threads.

julia
using IJulia
julia> installkernel("Julia (4 threads)", env=Dict("JULIA_NUM_THREADS"=>"4"))

(Be mindful of resource usage, if you're running on shared nodes...)

Jupyter on LXPLUS (and other clusters)

We can run jupyter also via ssh tunnel, instead of using swan. To do it, of course you need first to install jupyter (if you dont have it yet) on lxplus:

bash
pip install jupyterlab

Then, you should make sure that you're fowaridng a newtork port when connceting via ssh. This can be done by editing - on your laptop - the .ssh/config file and specify the 'LocalForward':

HOST lxplus9
    HostName LXPLUS9.CERN.CH
    ...
    LocalForward 1234 localhost:1234

Now, from a terminal connected to lxplus, you should start jupyter adding the flags:

bash
jupyter-lab --port=1234 --no-browser

Once the kernel sarts, you should be able to see something similar to:

...
[C 2024-05-23 19:06:45.333 ServerApp]
To access the server, open this file in a browser:
        file:///afs/cern.ch/user/s/sfranche/.local/share/jupyter/runtime/jpserver-1619301-open.html
    Or copy and paste one of these URLs:
        http://localhost:1234/lab?token=e97fbf2299c7f0a71ef70cef0105ddc49e23f230ac9da7d3
...

You can now copy paste the URL starting with http://localhost:1234/ in your local browser and enjoy yourjupyter session.

Jupyter on AF UChicago

When configure Jupyter notebooks, simply select ml-platform:julia as the image. The source Dockerfile can be found here.