Note: SLURM directives are special instructions in your job script (lines starting with #SBATCH). They control resources, job naming, output, and more. Dependencies let you control when jobs run.
Common Directives
| Directive | Description | Example | 
|---|---|---|
#SBATCH -p | 
			Choose a queue (partition) | #SBATCH -p short-40core | 
		
#SBATCH -N | 
			Number of nodes | #SBATCH -N 1 | 
		
#SBATCH -n | 
			Number of tasks (cores) | #SBATCH -n 4 | 
		
#SBATCH --mem | 
			Memory per node | #SBATCH --mem=16GB | 
		
#SBATCH -t | 
			Wall time (HH:MM:SS) | #SBATCH -t 01:00:00 | 
		
#SBATCH -J | 
			Job name | #SBATCH -J myjob | 
		
#SBATCH -o | 
			Standard output file | #SBATCH -o job_%j.out | 
		
#SBATCH -e | 
			Standard error file | #SBATCH -e job_%j.err | 
		
Job Dependencies
You can make one job wait for another to finish using --dependency. For example:
sbatch first_job.slurm sbatch --dependency=afterok:<jobid> second_job.slurm
afterok:<jobid>→ Run only if the first job succeeds.after:<jobid>→ Run after the job starts (any outcome).afternotok:<jobid>→ Run if the job fails.
Tips
- Use 
%jin filenames to include the job ID automatically. - Dependencies are useful for multi-step workflows (e.g., preprocessing → analysis → plotting).
 - Keep scripts simple: request only the resources and time you need.
 
