Julia¶
This comprehensive guide will help you set up and use Julia, a high-level, high-performance programming language.
Adding the Julia Kernel to OnDemand¶
Open OnDemand provides users with a graphical interface to the cluster, which provides an interactive user-interface for code development and testing. Currently OnDemand is available for Borah https://borah-ondemand.boisestate.edu
In order to use Julia in a Jupyter Notebook through OnDemand, you'll first need to install the IJulia kernel from the command line.
First, load any of the available Julia modules.
You can see the available modules using module avail -i julia
and load the module using module load julia/<version number here>
.
Next, load the Julia module, and open a Julia terminal:
module load julia
julia
julia>
using Pkg
Pkg.add("IJulia")
Finally, to use Julia in a notebook, navigate to the Jupyter Notebook App on https://borah-ondemand.boisestate.edu.
Once your Jupyter session starts, select the Julia kernel:
Julia Batch Script Example¶
Once you've developed and refined your Julia code, you may want to submit it as a batch submission to the scheduler. Following is an example of how to do just that.
-
Create your script. The example below is called
hello_world.jl
:hello_world.jlprint("Hello World")
-
Create your submission script. The example below is called
julia-slurm.sh
:julia-slurm.sh#!/bin/bash #SBATCH -J julia # job name #SBATCH -o log_slurm.o%j # output and error file name (%j expands to jobID) #SBATCH -n 1 # total number of tasks requested #SBATCH -N 1 # number of nodes you want to run on #SBATCH --cpus-per-task 1 #SBATCH -p bsudfq # queue (partition) #SBATCH -t 12:00:00 # run time (hh:mm:ss) # Load the Julia module module load julia # Run the example script julia hello_world.jl
-
Submit to the scheduler
sbatch julia-slurm.sh
Resources¶
- Julia Documentation: Comprehensive guides, tutorials, and references.
- Julia By Example: Practical examples of Julia programming.
- Julia Discourse: Community forum to seek help, share ideas, and learn.
- JuliaHub: Platform hosting interactive Julia notebooks.
- Julia Academy: Online courses and tutorials to enhance your Julia skills.