Sample Scripts

To submit a job to slurm, one can call "sbatch" with all necessary options, or put all options into a submission-script, then call "sbatch submission-script". Here are few samples of submission-script.


1) A simplest one core job.

Note: if this line "#SBATCH --account=admin" is omitted, job will run with user's default account if there is one, otherwise sbatch will fail with "sbatch: error: Batch job submission failed: Invalid account or account/partition combination specified".
#!/bin/bash

#SBATCH --partition=priority

#SBATCH --account=admin
#SBATCH --mem-per-cpu=512
printenv; date;

2) A 16 cores halld job which requests 4G (250MBx16) memory, 1GB (1000MB) disk space and 2 hours walltime. --chdir option set batch job working directory to /scratch/slurm/slurm-job-id.
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem-per-cpu=250
#SBATCH --job-name=test
#SBATCH --partition=priority
#SBATCH --account=halld
#SBATCH --mail-user=xxx@jlab.org
#SBATCH --time=2:00:00
#SBATCH --gres=disk:1000
#SBATCH --error=/home/y<user>/outdir/file.err
#SBATCH --output=/home/<user>/outdir/file.out

path_to_executable

3) A whole node clas12 job which requests a farm18 centos7 node, 24 hours walltime. The error and output files will go to /farm_out/<userName> directory and named as <jobName>-<jobId>-<hostname>.out.

Note:  use --exclusive to request a whole node, without requesting any memory.
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --exclusive
#SBATCH --job-name=rec-clas12-1-rgbv16dst6311r20_003
#SBATCH --output=/farm_out/%u/%x-%j-%N.out
#SBATCH --error=//farm_out/%u/%x-%j-%N.err
#SBATCH --partition=production
#SBATCH --account=clas12
#SBATCH --constraint=centos7,farm18
#SBATCH --gres=disk:5120
#SBATCH --time=24:00:00
path_to_executable


3)