
Chapter 7 Submit a Computing Script
Recall that on the SLURM system, there are two ways to access the Compute Node: an Interactive Session, or a computing script. The previous chapter focused on the former, and the current chapter will focus on the latter. Within a computing script, you will give short snippets of instructions for the Compute Node to run on its own. Unlike the Interactive Session, once you tell the Compute Node to run your computing script, you can’t interact with it - you wait until it is complete or you cancel it. This is the recommended practice from SciComp for running jobs on the Cluster.
Once you submit your script, the Fred Hutch cluster uses Slurm to organize and prioritize jobs. Based on the computing resources requested in your script, Slurm will find computing resources within the cluster to run your job along with all the other requests from other users.
In the next steps, we will go through a simple example where we download a single computing script and run it on the Compute Node.
The part of the cluster where you log in is called rhino
. The part of the cluster where jobs are run is called gizmo
.
7.1 Download the Script
We can use the wget
command to download a script from GitHub. This means we don’t have to write the script from scratch. Copy and paste the following into the terminal, and hit return:
wget https://raw.githubusercontent.com/FredHutch/slurm-examples/main/01-introduction/1-hello-world/01.sh
7.2 Confirm the Download
Let’s confirm that we can see the file we just downloaded. We can use the ls
(list files) command for this. Type ls
and hit return. You should see the file 01.sh
in your home directory. The .sh
ending means this is a script meant to run from the command line.
ls
7.3 Inspect the Script
Let’s next inspect the script. The cat
command, followed by a file name, lists the entire contents of a specific file.
cat 01.sh
- The first line of the script,
#!/bin/bash
, indicates that this is a command line or “bash” script. - The second line is empty, and the third line,
echo "Hello, World"
means that the computer will “echo”, or print out, “Hello, World”.
7.4 Submit the Script
We use the sbatch
command to submit a script and start running a job on the cluster. Copy the following and hit return. You should see a message like “Submitted batch job 12345678
”. Your number will vary because this is a unique job identifier.
sbatch 01.sh
7.5 Check the Output
Type ls
again. You should now see a log file like slurm-12345678.out
listed alongside your script 01.sh
. Let’s use cat
to inspect the output in the log file (the new file starting with slurm
and ending with .out
). Make sure you replace [your-number-here]
with the number in your actual file. We should see our message has been printed!
cat slurm-[your-number-here].out
ls
This command lists the files in the current directory.
cat filename
This command prints the contents of a specific file (filename).
sbatch filename.sh
This command submits a job to the cluster with instructions specified in a .sh
file.