This package provides support for using julia within the Slurm cluster environment. The code is adapted from ClusterManagers.jl with some modifications.
This script uses all resources from a Slurm allocation as julia workers and prints the id and hostname on each one.
#!/usr/bin/env julia
using Distributed, SlurmClusterManager
addprocs(SlurmManager())
@everywhere println("hello from $(myid()):$(gethostname())")
If the code is saved in script.jl
it can be queued and executed on two nodes using 64 workers per node by running
sbatch -N 2 --ntasks-per-node=64 script.jl
ClusterManagers.jl
SlurmManager
be created inside a Slurm allocation created by sbatch/salloc.SLURM_JOBID
and SLURM_NTASKS
must be defined in order to construct SlurmManager
.ClusterManagers.jl
will dynamically request resources when run outside of an existing Slurm allocation.