SLURM Demo: Difference between revisions

From Stat DS Computing Wiki
Jacobg2 (talk | contribs)
Jacobg2 (talk | contribs)
Line 1: Line 1:
This page will walk you through submitting a job using SLURM. It will also cover basic Linux usage.
This page will walk you through submitting a job using SLURM. It will also cover basic Linux usage.


=== Copy SLURM Demo Files ===
== Copy SLURM Demo Files ==
 


Log in to the head node server using your StatDS computing account through your terminal. (If you forget your password, reset it here.) This cluster is used for demonstration purposes only. Actual compute jobs are not meant to be submitted to this cluster.<syntaxhighlight lang="bash">
Log in to the head node server using your StatDS computing account through your terminal. (If you forget your password, reset it here.) This cluster is used for demonstration purposes only. Actual compute jobs are not meant to be submitted to this cluster.<syntaxhighlight lang="bash">
Line 13: Line 14:
</syntaxhighlight>
</syntaxhighlight>


=== Submit SLURM Job ===
== Submit SLURM Job ==
 
Modify the “submit_bash.sh” script. Make sure that you are in the correct directory that has the SLURM files from the section above.
 
Modify the “submit_bash.sh” script
 
You may use any text editor (vim, vi, nano, etc). In this example nano will be used.


''You may use any text editor (vim, vi, nano, etc). In this example nano will be used.''<syntaxhighlight lang="bash">
nano submit_bash.sh
nano submit_bash.sh
 
</syntaxhighlight>Change these three lines and make them more specific to you.<syntaxhighlight lang="bash">
Change these three lines and make them more specific to you.  
 
SBATCH --job-name=yourjobuniquename
SBATCH --job-name=yourjobuniquename
This is the name of your job.  
This is the name of your job.


SBATCH --output=yourjoboutputfile_%j.out
SBATCH --output=yourjoboutputfile_%j.out
Line 32: Line 28:
SBATCH --error=yourjoberrorfile_%j.err
SBATCH --error=yourjoberrorfile_%j.err
This is the name of your job’s error file. Any unintentional errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name.
This is the name of your job’s error file. Any unintentional errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name.
</syntaxhighlight>


Run the submit script
Run the submit script<syntaxhighlight lang="bash">
 
sbatch submit_bash.sh
sbatch submit_bash.sh
 
</syntaxhighlight>Once you submit your job, you can view the status of it by running the command below. This will show only your jobs<syntaxhighlight lang="bash">
# View Running Jobs
squeue -u $USER
 
</syntaxhighlight>To view every running job, run the command below.<syntaxhighlight lang="bash">
(Every job)
 
squeue
squeue
</syntaxhighlight>


(Only your jobs)
squeue -u $USER
View the output file once the script is finished (use your unique outfile name)


Once your job has finished, view the output file once the script is finished (use your unique outfile name)<syntaxhighlight lang="bash">
cat outputfile.out
cat outputfile.out
</syntaxhighlight>

Revision as of 14:31, 27 August 2025

This page will walk you through submitting a job using SLURM. It will also cover basic Linux usage.

Copy SLURM Demo Files

Log in to the head node server using your StatDS computing account through your terminal. (If you forget your password, reset it here.) This cluster is used for demonstration purposes only. Actual compute jobs are not meant to be submitted to this cluster.

ssh statdsuser@ood.stat.cmu.edu

Copy the SLURM Demo folder to your home directory. Do not run these files without moving them to your own working directory.

cp -r /share/slurmdemo ~/slurmdemo

Navigate to your new SLURM Demo directory.

cd ~/slurmdemo

View the contents of the SLURM Demo directory.

ls -l

Submit SLURM Job

Modify the “submit_bash.sh” script. Make sure that you are in the correct directory that has the SLURM files from the section above.

You may use any text editor (vim, vi, nano, etc). In this example nano will be used.

nano submit_bash.sh

Change these three lines and make them more specific to you.

SBATCH --job-name=yourjobuniquename
This is the name of your job.

SBATCH --output=yourjoboutputfile_%j.out
This is the name of your job’s output file. Any intentional output generated from your job will be placed into this file. The “%j” will add the job’s unique JobID to the name.

SBATCH --error=yourjoberrorfile_%j.err
This is the name of your job’s error file. Any unintentional errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name.

Run the submit script

sbatch submit_bash.sh

Once you submit your job, you can view the status of it by running the command below. This will show only your jobs

squeue -u $USER

To view every running job, run the command below.

squeue


Once your job has finished, view the output file once the script is finished (use your unique outfile name)

cat outputfile.out