Julia was created as an open source alternative to MATLAB and Octave.
module avail. To set the environment, load the module.
module load julia
Do not use Julia on a login node. Submit Julia scripts with a batch submission file, and use the HPC-VCL if doing interactive visualization with Julia.
Here is an example batch script. For more information on submitting batch scripts, see the documentation on running jobs.
For a sample Julia script called my_code.jl containing
# a simple Julia code using LinearAlgebra a = [1,2,4]; println("a",a) b = normalize(a) println("normalize(a)",b) println("norm(b)",norm(b))
and a sample submission script submit.csh
#!/bin/tcsh #BSUB -n 1 #BSUB -W 30 #BSUB -o out.%J #BSUB -e err.%J module load julia julia -p 1 my_code.jl
a batch job is submitted as
bsub < submit.csh
Script submit.csh requests the use of 1 core (-n 1) for up to 30 minutes (-W 30). The output in out.JOBID is
a[1, 2, 4] normalize(a)[0.2182178902359924, 0.4364357804719848, 0.8728715609439696] norm(b)1.0Check the documentation on running jobs to customize the batch script.
Additional packages outside of the base Julia install must be installed by the user. See the instructions for request a space for user maintained software.
The basic process to install a new Julia package is to use Pkg.add from a login node. By default, Julia will install the packages in the home directory in ~/.julia. That will quickly fill the home directory. Before installing packages, set the location for the installs by setting JULIA_DEPOT_PATH to the user maintained software directory.
setenv JULIA_DEPOT_PATH /usr/local/usrapps/[your space for user maintained software]/[whatever you want to call the julia apps directory]
module load julia julia import Pkg Pkg.add("whatever")Check the Julia documentation on setting environment variables.
Last modified: March 23 2022 13:21:50.