SCRP nodes have Julia 1.7.1 installed.
To use Julia in console mode, type in a terminal:
To run a Julia script, type:
Using Julia on JupyterHub
You can add Julia to JupyterHub by executing the following code snippet within Julia:
using Pkg Pkg.build("IJulia")
Installing Additional Packages
First, create a new environment or activate an existing environment:
using Pkg Pkg.activate("environment_name")
Now you can install new packages as needed:
Running on a Compute Node - Short Duration
You should run your job on a compute node if you need more processing power.
To run Jupyter notebooks on a compute node, following the instructions here.
To run Julia on a compute node in a terminal, simply prepend
JULIA_NUM_THREADS=4 compute julia
This launches Julia on a compute node with four logical CPUs and 8GB of RAM,
for a duration of 24 hours.
Note that it is necessary to set the environment variable
the number of logical CPUs you are requesting, otherwise Julia will default to
using a single thread. You can check the number of threads Julia is using by typing
If you need GPU, prepend
JULIA_NUM_THREADS=4 gpu julia
To check if a GPU is truly available, type in Julia:
using CUDA CUDA.deviceid()
This will return a number if a GPU is available and return error otherwise.
You can request more logical CPUs with the
-c option, more memory with the
more time with the
-t option and specify GPU model with the
For example, to request 16 CPUs, 40G of memory and one RTX 3090 GPU for three days:
JULIA_NUM_THREADS=16 compute -c 16 --mem=40G --gpus-per-task=rtx3090 -t 3-0 julia
Running on a Compute Node - Long Duration
Codes that take a long time to run is best initiated through Slurm’s
which allows you to submit a job without the need to wait for it to execute.
Your code will run even if you disconnect from the cluster.
First create a script, hypothetically named my_job.sh:
#!/bin/bash #SBATCH --job-name=my_sid #SBATCH --ntasks=1 #SBATCH --cpus-per-task=2 JULIA_NUM_THREADS=2 julia file_path
#SBATCH comments specify various options. In this example, we are requesting two logical CPUs
for a single task.
Now submit your job:
Subject to available resources, your code will run even if you disconnect from the cluster. The maximum job duration is 5 days.