Difference between revisions of "Annotated SLURM Script"
Moskalenko (talk | contribs) |
m (fixed analysis spelling) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category: | + | [[Category:Scheduler]] |
− | This is a walk-through for a basic SLURM scheduler job script for a common case of a multi-threaded | + | This is a walk-through for a basic SLURM scheduler job script for a common case of a multi-threaded analysis. If the program you run is single-threaded (can use only one CPU core) then only use '--ntasks=1' line for the cpu request instead of all three listed lines. Annotations are marked with bullet points. You can click on the link below to download the raw job script file without the annotation. Values in brackets are placeholders. You need to replace them with your own values. E.g. Change '<job name>' to something like 'blast_proj22'. We will write additional documentation on more complex job layouts for MPI jobs and other situations when a simple number of processor cores is not sufficient. |
− | + | {|cellspacing=30 | |
+ | |-style="vertical-align:top;" | ||
+ | |style="width: 50%"| | ||
+ | ;Set the shell to use | ||
<pre> | <pre> | ||
#!/bin/bash | #!/bin/bash | ||
Line 14: | Line 17: | ||
:Your email address to use for all batch system communications | :Your email address to use for all batch system communications | ||
<pre> | <pre> | ||
− | ##SBATCH --mail-user=<EMAIL> | + | #SBATCH --mail-user=<EMAIL> |
+ | #SBATCH --mail-user=<EMAIL-ONE>,<EMAIL-TWO> | ||
</pre> | </pre> | ||
;What emails to send | ;What emails to send | ||
Line 43: | Line 47: | ||
#SBATCH --cpus-per-task=4 | #SBATCH --cpus-per-task=4 | ||
</pre> | </pre> | ||
+ | || | ||
;Total memory limit for the job. Default is 2 gigabytes, but units can be specified with mb or gb for Megabytes or Gigabytes. | ;Total memory limit for the job. Default is 2 gigabytes, but units can be specified with mb or gb for Megabytes or Gigabytes. | ||
<pre> | <pre> | ||
Line 57: | Line 62: | ||
#SBATCH --account=<GROUP> | #SBATCH --account=<GROUP> | ||
</pre> | </pre> | ||
− | :A job array, which will create many jobs (called array tasks) different only in the '<code>$SLURM_ARRAY_TASK_ID</code>' variable | + | :A job array, which will create many jobs (called array tasks) different only in the '<code>$SLURM_ARRAY_TASK_ID</code>' variable |
<pre> | <pre> | ||
#SBATCH --array=<BEGIN-END> | #SBATCH --array=<BEGIN-END> | ||
Line 81: | Line 86: | ||
date | date | ||
</pre> | </pre> | ||
+ | |} |
Latest revision as of 20:49, 13 May 2024
This is a walk-through for a basic SLURM scheduler job script for a common case of a multi-threaded analysis. If the program you run is single-threaded (can use only one CPU core) then only use '--ntasks=1' line for the cpu request instead of all three listed lines. Annotations are marked with bullet points. You can click on the link below to download the raw job script file without the annotation. Values in brackets are placeholders. You need to replace them with your own values. E.g. Change '<job name>' to something like 'blast_proj22'. We will write additional documentation on more complex job layouts for MPI jobs and other situations when a simple number of processor cores is not sufficient.
#!/bin/bash
#SBATCH --job-name=<JOBNAME>
#SBATCH --mail-user=<EMAIL> #SBATCH --mail-user=<EMAIL-ONE>,<EMAIL-TWO>
#SBATCH --mail-type=FAIL,END
#SBATCH --output <my_job-%j.out>
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4 |
#SBATCH --mem=4gb
#SBATCH --time=72:00:00
#SBATCH --account=<GROUP>
#SBATCH --array=<BEGIN-END>
date;hostname;pwd Below is the shell script part - the commands you will run to analyze your data. The following is an example.
module load ncbi_blast
blastn -db nt -query input.fa -outfmt 6 -out results.xml --num_threads 4 date |