This repository is an example for how to set up scripts to submit an array of SLURM jobs (all running the same program) each with their own initial parameters. These scripts are written to work on Digital Research Alliance of Canada (DRAC) HPC clusters, but should work on other systems that use the SLURM scheduler.
-
slurm_starts.shis the BASH script that will submit the SLURM jobs. It contains the location to the template directory and the file that contains each run name and its initial parameters. This script is submitted to the SLURM scheduler and run by each job in the array. -
make_wds.pyis the python script that handles reading the initial parameters file and copying the template directory to generate the new working directories. -
params.txtis the initial parameters file. Each line contains the run's name and its three initial parameters. -
prog_run.shis the program run script. This script is what is used byslurm_stars.shto run the program. In this example (running a python program), it is very simplistic. -
template_wdis the template directory that contains the python program and its template initial parameters file. -
template_wd/example_prog.pyis the python program. This program numerically solves the equations of motion for projectile motion until the projectile hits the ground ($y_f\approx 0$ ). All the relevant data is output tooutput.dataThis program was generated by AI as it is just an example. -
template/initial_conditions.txtis the template initial parameters file. This file is read bytemplate_wd/example_prog.pyto generate the simulation. It contains the placeholder values 'PARAM1', 'PARAM2', and 'PARAM3' which are to be changed by themake_wds.pyscript in the new run directories.
-
Generate the initial parameters file (
params.txthere). This can be done by hand for small numbers of runs. -
Set the job run time, name, number of CPUs, amount of RAM, and number of jobs in the array in
slurm_start.sh. Also setTEMPLATE_DIRandPARAMS_FILE. -
Set
param_placeholdersandfiles_to_replaceinmake_wds.py. -
Configure
prog_run.shto run your desired program. -
Submit the
slurm_start.shfile to the scheduler using:
sbatch slurm_start.sh