What is Julia
Julia is a relatively young programming language for numerical computing with JIT (Just-In-Time) techniques implemented for faster execution.
Using Julia in HPC system
To setup required environment variables for Julia, please use following command. The version shown in bold is the default version on the corresponding HPC system.
System | Julia version | Command |
HPC2015 | 0.5.2 | module load julia/0.5.2 |
0.6.2 | module load julia/0.6.2 | |
0.7.0 | module load julia/0.7.0 | |
1.0.2 | module load julia/1.0.2 | |
1.3.1 | module load julia/1.3.1 | |
HPC2021 | 1.6.1 | module load julia/1.6.1 |
Should you receive any error on Julia 1.0.2 with some existing code, please retry that with Julia 0.7.0 and check the warning messages. There was quite a number of changes in the language which breaks existing code should it was written before the 1.0 series is released.
To work with Julia code interactively, type julia . To quit the julia environment, type quit() (before version 0.7.0) / exit() (at or after version 0.7.0) in the julia prompt.
Interactive process that executes over 15 minutes would be killed automatically. User are advised to run Julia in batch mode by submitting job to the PBS queuing system with the way specified in the next heading.
Run batch Julia jobs
julia --history-file=no < INPUT_FILE > OUTPUT_FILE
Or, alternatively
julia --history-file=no INPUT_FILE.jl > OUTPUT_FILE
Run parallel Julia jobs
Julia has its own @parallel keyword which provides both internode and intranode parallelism natively. Other libraries, such as OpenMP or MPI, are not needed.
Julia documentation on the @parallel keyword is at https://docs.julialang.org/en/v0.6.2/stdlib/parallel/#Base.Distributed.@parallel
Sample PBS command files and programs for both serial and parallel Julia program are provided at /share1/julia/samples
Julia Package Managements (before v0.7.0)
To initiate Julia’s built-in package manager. On default it stores the packages at your home directory (see https://docs.julialang.org/en/v0.6.0/stdlib/pkg/#Base.Pkg.dir for documentation).
That should be acceptable for most users. In other cases they may set their packages path through JULIA_PKGDIR environment string or setting Pkg.dir() inside Julia.
Selected package management commands:
To initialize the package directory, use Pkg.init().
To list packages installed, use Pkg.status().
To install a package called Example, type: Pkg.add("Example")
For others, one is advised to consult Julia documents.
Julia Package Managements (at or after v0.7.0)
To initiate Julia’s built-in package managee, the “pkg” mode, press ] key in the command prompt (to leave that mode, “backspace” at an empty prompt or use Ctrl+C). That should be acceptable for most users.
Selected package management commands:
To initialize the package directory, use activate.
To list packages installed, use status.
To install a package called Example, type: add Example.
For others, one is advised to consult Julia documents.
Further Readings
Official Julia documentations: https://docs.julialang.org/
Julia package list: https://pkg.julialang.org/