Find julia module
Load Julia from module system (eg):
Use module spider julia and find a version.
Example:
module load Julia/1.7.2-linux-x86_64
Install MPI for Julia on login node (only once)
Before starting julia set enviroment variable to local folder (HOME) as eg
export JULIA_DEPOT_PATH=./juliapackages/
Start julia: $julia
julia>import Pkg
julia>Pkg.add("MPI")
Test installation:
julia>using MPI (if no error message it works)
Exit Julia:
julia>exit()
Run MPI Julia
Job script (example): (file name eg job.sh)
!/bin/bash
#SBATCH -J job # Sensible name for the job
#SBATCH --account=<my account>
#SBATCH -N 2 # Allocate 2 nodes for the job
#SBATCH --ntasks-per-node=1
#SBATCH -c 20 # 20 cores each node
#SBATCH -t 00:10:00 # Upper time limit for the job
#SBATCH -p CPUQ
module load foss/2022a
module load Julia/1.7.2-linux-x86_64
WORKDIR=${SLURM_SUBMIT_DIR}
cd ${WORKDIR}
srun julia mympiprogram.jl
Example Juila MPI program (mympiprogram.jl)
using MPI
MPI.Init()
comm=MPI.COMM_WORLD
ranks=MPI.Comm_size(comm)
rank=MPI.Comm_rank(comm)
print("Hello world from rank $(rank) of $(ranks)\n")
Run your mpi program
sbatch job.sh
Check job status
squeue -u username
Cancel job
scancel jobid