Running Julia on Grex

Introduction#


Julia is a programming language that was designed for performance, ease of use and portability. It is available as a module on Grex.

Available Julia versions#


Presently, binary Julia version julia/1.10.3 is available. Use module spider julia to find out other versions.

Installing packages#


We do not maintain centralized versions of Julia packages. Users should install Julia modules in their home directory.

The command is (in Julia REPL):

Using Pkg; Pkg.Add("My-Package")

In case of package/version conflicts, remove the packages directory ~/.julia/.

Using Julia notebooks#


It is possible to use IJulia kernels for Jupyter notebooks. A preferable way of running a Jupyter notebook is SLURM interactive job with salloc command.

(More details coming soon).

Running Julia jobs#


Julia comes with a large variety of packages. Some of them would use threads; and therefore, have to be run as SMP jobs with –cpus-per-task specified. Moreover, you would want to set the JULIA_NUM_THREADS environment variable in your job script to be the same as SLURM’s number of threads.

Script example for running Julia on Grex
run-julia.sh
#!/bin/bash

#SBATCH --ntasks=1 
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=4000M
#SBATCH --time=8:00:00
#SBATCH --job-name=Julia-Test

# Load the modules:

module load julia/1.10.3

echo "Starting run at: `date`"

julia test-julia.jl

echo "Program finished with exit code $? at: `date`"

Assuming the script above is saved as run-julia.sh, it can be submitted with:

sbatch run-julia.sh

For more information, visit the page running jobs on Grex

Using Julia for GPU programming#


It is possible to use Julia with CUDA Array objects to greatly speed up the Julia computations. For more information, please refer to this link: julia-gpu-programming . However, a suitable “CUDA” module should be loaded during the installation of the CUDA Julia packages. And you likely want to be on a GPU node when the Julia GPU code is executed.