Julia Programming Language
As a result of the JIT compilation, implemented using LLVM, Julia is able to accomplish this by allowing optional typing, multiple dispatch, and type inference. Julia is also a multi paradigm programming language that combines imperative, functional, and object-oriented features. Thus, Julia is considered a scientific programming language and is well suited to statistics, machine learning, data science, as well as light and heavy computations.
Julia can be used and variety of means on Europa.
The simplest means is by loading a module which is pre-installed on Europa. Several different compilers can be used to cross-compile modules, giving the HPC cluster great flexibility. Using a pre-installed module, however, restricts users to the Julia versions the module is available in.
$ julia -bash: julia: command not found $ ml avail julia --------------------------------------------------------- /opt/ohpc/pub/unpackaged/modulefiles --------------------------------------------------------- julia/1.7.2 $ ml load julia/1.7.2 $ julia (base) [lhw150030@login-01 ~]$ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.7.2 (2022-02-06) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia>
At this point you have access to the Command Line Version of Julia or the Read Evaluate Print Loop (REPL). Simple code snippets can be used to check if everything is working properly.
julia> println("Hello World!") Hello World! julia> x= 1+2 3
Note: You shouldn’t run any significant computations on the login nodes, but it’s a great way to make sure everything works.
The Julia Binaries can be installed using any Julia version you wish, which allows you to mitigate issues arising in the future as Julia continues to evolve. In order to avoid getting multiple versions of Julia if you have followed the previous steps, you should log out and log back in. On your home directory create a Software folder and download the appropriate Julia binaries.
$ cd ~ $ mkdir Software $ cd Software/ $ wget https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.1-linux-x86_64.tar.gz $ tar -xzf julia-1.8.1-linux-x86_64.tar.gz $ ./julia-1.8.1/bin/julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.8.1 (2022-09-06) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ |
Note: It is entirely up to the user to choose where to download the binaries
Additionally, it is advisable to add Julia’s bin folder (with full path) to PATH environment
variable, you can edit the
export PATH="$PATH:/home/<NET ID>/Software/julia-1.8.1/bin"
Depending on where Julia is installed, standard libraries can be found at
share/julia/stdlib. Julia’s ecosystem is built by external contributors and they are simply available
on GitHub repositories.
The package listings can be found here.
Julia has an in built package manager
Pkg which can be used to install any packages written
in Julia. This is quite similar to pip package manager on Python. Version control and
dependency management is handled automatically by
Pkg. Julia also offers a REPL for
Pkg and this can be accessed entering the ']' key on the Julia REPL.
To install packages the add keyword followed by the package name can be used within
st (stands for status) command on the package manager is used to track the current state of the Julia environment.
(@v1.8) pkg> st Status `~/.julia/environments/v1.8/Project.toml` (empty project) (@v1.8) pkg> add Revise (@v1.8) pkg> add BenchmarkTools Statistics (@v1.8) pkg> st Status `~/.julia/environments/v1.8/Project.toml` [6e4b80f9] BenchmarkTools v1.3.1 [295af30f] Revise v3.4.0 [10745b16] Statistics
To return to back to the Julia REPL,
Backspace can be used.