To run a job on the cluster in the jobs queue, the name of the primary SLURM partition, you must create what is known as a submit file. The submit file lets the scheduler know what resources your job requires (number of processors, amount of memory, walltime, etc.). The following submit file will be used to run your first job.

#!/bin/bash -l
#SBATCH --partition=jobs
#SBATCH --job-name=basic_slurm_job
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=1:00:00

echo "======================================================"
echo "Start Time : $(date)"
echo "Submit Dir : $SLURM_SUBMIT_DIR"
echo "Job ID/Name : $SLURM_JOBID / $SLURM_JOB_NAME"
echo "Num Tasks : $SLURM_NTASKS total [$SLURM_NNODES nodes @ $SLURM_CPUS_ON_NODE CPUs/node]"
echo "======================================================"
echo ""

cd $SLURM_SUBMIT_DIR
echo "Hello World! I ran on compute node $(/bin/hostname -s)"

echo ""
echo "======================================================"
echo "End Time : $(date)"
echo "======================================================"

Let's take a quick look at each section of the submit file to understand the structure.

The first section contains the scheduler directives. The directives below are running the job in the BASH shell, in the jobs SLURM partition, setting the name of the job to basic_slurm_job, requesting a single core on a single node, and asking for these resources for up to 1 hour:

#!/bin/bash

#SBATCH --partition=jobs
#SBATCH --job-name=basic_slurm_job
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=1:00:00

The second section prints out information, such as today's date, the directory the job resides in, the job's ID and name, as well as the total number of tasks and a node list:

echo "======================================================"
echo "Start Time : $(date)"
echo "Submit Dir : $SLURM_SUBMIT_DIR"
echo "Job ID/Name : $SLURM_JOBID / $SLURM_JOB_NAME"
echo "Num Tasks : $SLURM_NTASKS total [$SLURM_NNODES nodes @ $SLURM_CPUS_ON_NODE CPUs/node]"
echo "======================================================"
echo ""

The third section is the portion of the submit file where your actual program will be specified. In this example, the job is just returning the directory that contains the SLURM submit script and printing out a message, as well as the compute node name to the output file:

cd $SLURM_SUBMIT_DIR
echo "Hello World! I ran on compute node $(/bin/hostname -s)"

The final section appends the job's completion time to the output file:

echo ""
echo "======================================================"
echo "End Time : $(date)"
echo "======================================================"

To run this first job. Login to the login node, create a file called basic-submit.slurm and past the above script into the file.

Then submit the script using the slurm scheduler:

$ sbatch basic-submit.slurm
Submitted batch job 18513

Once your job completes you should see the following(or similar since the actual compute node could be different) when you cat your output file:

$ cat slurm-18513.out

======================================================
Start Time : Mon Sep 29 09:48:26 EDT 2025
Submit Dir : /home/jlkarau
Job ID/Name : 18513 / basic_slurm_job
Num Tasks : total [1 nodes @ 1 CPUs/node]
======================================================

Hello World! I ran on compute node compute-0-7

======================================================
End Time : Mon Sep 29 09:48:26 EDT 2025
======================================================

Additional sample batch files

There are additional sample batch files on the system that you can copy into your home directory:

$ cp /mnt/it_research/examples/bioinformatics/* .
$ cp /mnt/it_research/examples/mri/* .
$ sbatch bio_cpu1_test
Submitted batch job 18514

cat slurm-18514.out

Additional scripts you copied to your home directory:

$ ls bio*
bio_gpu1_test
bio_gpu4_test
bio_jobs_test
bio_largemem_test

$ ls mri_*
mri_gpu1_test
mri_gpu4_test
mri_jobs_test
mri_largemem_test

Since you have copied these to your home directory you can edit and modify them as needed or use them as the start of your own batch file.