Slurm Demo: Difference between revisions
No edit summary |
No edit summary |
||
| (20 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Wright Cluster]] | |||
[[Category:PSC]] | |||
[[Category:Remote Server Access]] | |||
This page will walk you through submitting a job via SLURM. | This page will walk you through submitting a job via SLURM. | ||
== Aquire SLURM Demo Files == | |||
1 - Log in to the head node server using your StatDS computing account through your terminal. (If you forget your password, [https://util.stat.cmu.edu/passwordreset/ 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'' | ''ssh statdsuser@ood.stat.cmu.edu'' | ||
| Line 19: | Line 26: | ||
''ls -l'' | ''ls -l'' | ||
== Run Batch Submit Scripts == | |||
1 - Modify the “submit_bash.sh” script. You may use any text editor (vim, vi, nano, etc). Nano will be used in this example. | |||
1 - Modify the “submit_bash.sh” script | |||
You may use any text editor (vim, vi, nano, etc). | |||
''nano submit_bash.sh'' | ''nano submit_bash.sh'' | ||
2 - Change these three lines and make them more specific to you. | 2 - Change these three lines and make them more specific to you. | ||
Name of your job. | |||
#SBATCH --job-name=yourjobuniquename | #SBATCH --job-name=yourjobuniquename | ||
Name of your job’s output file. Any output generated from your job will be placed into this file. The “%j” will add the job’s unique JobID to the name. | |||
#SBATCH --output=yourjoboutputfile_%j.out | #SBATCH --output=yourjoboutputfile_%j.out | ||
Name of your job’s error file. Any errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name. | |||
#SBATCH --error=yourjoberrorfile_%j.err | #SBATCH --error=yourjoberrorfile_%j.err | ||
3 - Run the submit script. | |||
3 - Run the submit script | |||
''sbatch submit_bash.sh'' | ''sbatch submit_bash.sh'' | ||
4 - View Running Jobs | 4 - View Running Jobs. | ||
(Every job) | (Every job) | ||
''squeue'' | ''squeue'' | ||
| Line 50: | Line 55: | ||
''squeue -u $USER'' | ''squeue -u $USER'' | ||
5 - View the output file once the script is finished (use your unique outfile name) | 5 - View the output file once the script is finished (use your unique outfile name). | ||
''cat outputfile.out'' | ''cat outputfile.out'' | ||
== Error Example Script == | |||
In addition to the regular output file, SLURM produces a dedicated file that contains any errors in your script. In some cases, this is the only file that will contain any output. | |||
Error file name is declared in your submit script as shown… | |||
#SBATCH --error=yourjoberrorfile_%j.err | #SBATCH --error=yourjoberrorfile_%j.err | ||
To see an example, submit the job with a syntax error. | |||
''sbatch submit_err.sh'' | ''sbatch submit_err.sh'' | ||
View the contents of the error output file. | |||
cat yourjoberrorfile_%j.err | |||
Requesting Additional Resources | == Requesting Additional Resources == | ||
SLURM allows you to request multiple CPU cores, a specified amount of RAM, and even GPUs if they are available. Requesting more than 1 CPU is especially important when paralyzing tasks.Below is an example submit script that shows how to declare each. | SLURM allows you to request multiple CPU cores, a specified amount of RAM, and even GPUs if they are available. Requesting more than 1 CPU is especially important when paralyzing tasks.Below is an example submit script that shows how to declare each. | ||
#!/bin/bash | #!/bin/bash | ||
#SBATCH --partition selectedpartition | #SBATCH --partition selectedpartition | ||
#SBATCH --ntasks 1 | #SBATCH --ntasks 1 | ||
# | # # Number of CPUs you need: | ||
#SBATCH --cpus-per-task 1 | #SBATCH --cpus-per-task 1 | ||
# Amount of RAM in GB | # # Amount of RAM in GB | ||
#SBATCH --mem 1G | #SBATCH --mem 1G | ||
# Number of GPUs | # # Number of GPUs | ||
#SBATCH --gres=gpu:1 | #SBATCH --gres=gpu:1 | ||
Latest revision as of 03:20, 29 June 2026
This page will walk you through submitting a job via SLURM.
Aquire SLURM Demo Files
1 - 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
2 - 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
3 - Navigate to your new Slurm Demo directory.
cd ~/slurmdemo
4 - View the contents of the Slurm Demo directory.
ls -l
Run Batch Submit Scripts
1 - Modify the “submit_bash.sh” script. You may use any text editor (vim, vi, nano, etc). Nano will be used in this example.
nano submit_bash.sh
2 - Change these three lines and make them more specific to you.
Name of your job.
#SBATCH --job-name=yourjobuniquename
Name of your job’s output file. Any output generated from your job will be placed into this file. The “%j” will add the job’s unique JobID to the name.
#SBATCH --output=yourjoboutputfile_%j.out
Name of your job’s error file. Any errors generated in the script will be placed into this file. The “%j” will add the job’s unique JobID to the name.
#SBATCH --error=yourjoberrorfile_%j.err
3 - Run the submit script.
sbatch submit_bash.sh
4 - View Running Jobs.
(Every job) squeue (Only your jobs) squeue -u $USER
5 - View the output file once the script is finished (use your unique outfile name).
cat outputfile.out
Error Example Script
In addition to the regular output file, SLURM produces a dedicated file that contains any errors in your script. In some cases, this is the only file that will contain any output.
Error file name is declared in your submit script as shown…
#SBATCH --error=yourjoberrorfile_%j.err
To see an example, submit the job with a syntax error.
sbatch submit_err.sh
View the contents of the error output file.
cat yourjoberrorfile_%j.err
Requesting Additional Resources
SLURM allows you to request multiple CPU cores, a specified amount of RAM, and even GPUs if they are available. Requesting more than 1 CPU is especially important when paralyzing tasks.Below is an example submit script that shows how to declare each.
#!/bin/bash #SBATCH --partition selectedpartition #SBATCH --ntasks 1
# # Number of CPUs you need: #SBATCH --cpus-per-task 1
# # Amount of RAM in GB #SBATCH --mem 1G
# # Number of GPUs #SBATCH --gres=gpu:1