---
title: "SLURM Overview and Job Submission"
canonical: "https://kb.uconn.edu/space/SH/28016050215/SLURM%20Overview%20and%20Job%20Submission"
format: markdown
---
The Storrs HPC has 300+ active users that share the available computing resources. To ensure fair usage across all jobs, the **SLURM** resource scheduler manages where jobs land and when they begin.

![ChatGPT Image Sep 25, 2025, 01_31_16 PM.png](media://ea6d0545-7502-4e06-89bc-368bdda25c32)

SLURM, also known as “Simple Linux Utility for Resource Management”, acts as a waiter that manages the queue outside the restaurant. Based on what the customers request, the waiter is able to assign them to their desired tables based on availability. 

![ChatGPT Image Sep 25, 2025, 02_45_54 PM.png](media://674475af-25c2-47f6-86ac-6d23215894df)

The tables here represent compute nodes with different availabilities. Table 1 (top left) is reserved for maintenance or testing. Table 2 (top right) is idle and ready for jobs. Table 3 (bottom left) is partially allocated in a mixed state. Finally, Table 4 (bottom right) is fully allocated and will not be available until a customer leaves.

Let’s log on to the cluster to see it in action!

```
ssh <your_NetID>@hpc2.storrs.hpc.uconn.edu
```

The `sinfo` command can be used to check the `general` partition for node availability and some other useful information.

```
[jth1234@login4 ~]$ sinfo -p general
PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST
general*     up   12:00:00      2  maint cn[473,643]
general*     up   12:00:00    143    mix cn[454,456-458,460-461,466,468-472,474-479,482,484,486-489,491-494,496-499,503,510,512-513,515-522,524-526,528-530,536-545,551-553,557-562,564-572,574-580,582-601,603-608,613,615,617-619,625-627,629,632,634,637-638,641-642,644,648-660,662,665-666]
general*     up   12:00:00     57  alloc cn[453,462-465,467,480,483,485,490,500-502,504-509,511,514,523,527,532-535,546-550,555-556,573,581,610-612,614,620-624,628,630-631,633,635-636,640,645-647,663-664]
general*     up   12:00:00      1   idle cn455
```

### Submitting Your First Job

> 📝 **Login Node Etiquette **
> 📝 
> 📝 Reminder: After logging on to a cluster, users do not communicate directly with a computational node. Instead, they connect to a **login node **first.
> 📝 
> 📝 Login nodes are shared by ~20-40 users at a time and should not be used for any computation work. Simple tasks like small file transfers, text editors, etc. are allowed ([a non-exhaustive list of programs](https://uconn.atlassian.net/wiki/spaces/SH/pages/26033979893/FAQ#%F0%9F%94%B9--What-programs-am-I-allowed-to-run-on-the-login-nodes%3F)).

On the HPC, batch jobs are tasks you give to the HPC to do later. You tell SLURM what needs to be done, like run a program, and it does it when it’s ready. You don’t have to wait for it to finish, and you don’t need to keep any windows open while it’s running. 

To do this, we create a script (often called an sbatch script) and submit it to the SLURM scheduler. Sbatch scripts specify both the required resources of a job and the commands to be executed. Let’s walk through an example:

1. SSH into the HPC
2. Create an empty file

```
touch my_job.sh
```

3. Read the following annotated script. The notes on the right say what each command does. The first line (the shebang) indicates the script is written in `bash`.

```
#!/bin/bash
#SBATCH -J my_first_job                 # name of job
#SBATCH --ntasks=1                      # requesting 1 CPU core
#SBATCH --nodes=1                       # on one node
#SBATCH --time=5:00                     # for 5 minutes max
#SBATCH -o my_first_job.out             # name of the job's output file

# example of a script
echo "Hello, world!"                    # prints "Hello, world"
echo "This message is coming live from: "
hostname                                # prints the name of the compute node
echo "Today's date and time is:"
echo $(date)                            # prints the date and time
sleep 2m                                # waits for 2 minutes (zzz)
echo "Now the time is: "                
echo $(date)

# End of file = end of script
echo "Goodbye!"
```

The section at the top (with lines beginning with #SBATCH) is the SBATCH header. This is where you specify the resources required for your job. The rest of the script contains the commands that will be run by the compute node.

4. Copy this script onto the HPC using your favorite **[text editor](https://kb.uconn.edu/space/SH/26479394921/Text+Editors#Job-Examples)**. Here, we’ll use `nano`.

```
nano my_first_job.sh
```

5. Copy the sbatch script from this window
6. Paste into `nano` using Ctrl+Shift+V
7. Save the file with Ctrl+S
8. Exit `nano` with Ctrl+X
9. Submit the script using `sbatch`

```
sbatch my_first_job.sh
```

**Congrats! You’ve submitted your first job! **🥳

You can use the `sjobs` command (or `squeue --me`) to keep an eye on it while it’s running. With sjobs, the line under the State column will tell you if your job is “Pending” or “Running.”  You’ll know your job has completed if it’s no longer in the `sjobs`output. 

We can look at the output using the `cat` command. It should look something like this:

```
[jth12345@login4 ~]$ cat my_first_job.out
Hello, world!
This message is coming live from:
cn453.storrs.hpc.uconn.edu
Today's date and time is:
Thu Apr 16 16:07:29 EDT 2026
Now the time is:
Thu Apr 16 16:09:29 EDT 2026
Goodbye!
```

This script is just the beginning! 🙂 To learn more about submitting jobs with `sbatch`, please read our <u>[SLURM Guide](https://kb.uconn.edu/space/SH/26032963685/SLURM+Guide)</u>.

> ℹ️ **Next:** [https://uconn.atlassian.net/wiki/spaces/SH/pages/28714860567](https://uconn.atlassian.net/wiki/spaces/SH/pages/28714860567)