Julia
Julia is a high-level, high-performance, dynamic programming language. While it is a general-purpose language and can be used to write any application, many of its features are well suited for numerical analysis and computational science.
Slurm Script
#!/bin/bash # This is a slurm script for running Julia across # multiple cores of one compute node #SBATCH -p CUIQue ####SBATCH -A hpc_build #SBATCH --time=1:00:00 ###SBATCH --mail-type=end ###SBATCH --mail-user=teh1m@virginia.edu #SBATCH --job-name=multipleTest1 #SBATCH --output=multipleTest1_%A.out #SBATCH --error=multipleTest1_%A.err #SBATCH --nodes=4 #Number of nodes #SBATCH --ntasks-per-node=1 #Number of cores per node #SBATCH --cpus-per-task=8 #Number of cores per node # Load Julia environment module load julia/1.6.3 srun julia helloDistributed.jl
The Code helloDistributed.jl
using Distributed # launch worker processes num_cores = parse(Int, ENV["SLURM_CPUS_PER_TASK"]) addprocs(num_cores) println("Number of cores: ", nprocs()) println("Number of workers: ", nworkers()) # each worker gets its id, process id and hostname for i in workers() id, pid, host = fetch(@spawnat i (myid(), getpid(), gethostname())) println(id, " " , pid, " ", host) end # remove the workers for i in workers() rmprocs(i) end
Submit the job to the scheduler as
sbatch YourJuliaScript.slurm
For managing your “job” , refer to this guide.
For more on Julia, refer to their official documentation
https://docs.julialang.org/en/v1/