Difference between revisions of "Annotated SLURM Script"
Moskalenko (talk | contribs) |
Moskalenko (talk | contribs) |
||
Line 3: | Line 3: | ||
This is a walk-through for a basic SLURM scheduler job script. 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. | This is a walk-through for a basic SLURM scheduler job script. 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. | ||
− | Download raw source of the [{{#fileLink: | + | Download raw source of the [{{#fileLink: run.sh}} run.sh] file. |
* Set the shell to use | * Set the shell to use | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#!/bin/bash | #!/bin/bash | ||
Line 11: | Line 11: | ||
;Common arguments | ;Common arguments | ||
* Name the job to make it easier to see in the job queue | * Name the job to make it easier to see in the job queue | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --job-name=<JOBNAME> | #SBATCH --job-name=<JOBNAME> | ||
Line 17: | Line 17: | ||
;Email | ;Email | ||
:Your email address to use for all batch system communications | :Your email address to use for all batch system communications | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
##SBATCH --mail-user=<EMAIL> | ##SBATCH --mail-user=<EMAIL> | ||
Line 25: | Line 25: | ||
:ALL - all emails | :ALL - all emails | ||
:END,FAIL - only email if the job fails and email the summary at the end of the job | :END,FAIL - only email if the job fails and email the summary at the end of the job | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --mail-type=FAIL,END | #SBATCH --mail-type=FAIL,END | ||
Line 33: | Line 33: | ||
:: %j - job id | :: %j - job id | ||
:: %A-$a - Array job id (A) and task id (a) | :: %A-$a - Array job id (A) and task id (a) | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --output <my_job-%j.out> | #SBATCH --output <my_job-%j.out> | ||
Line 39: | Line 39: | ||
</source> | </source> | ||
;Number of tasks (usually translate to processor cores) to use | ;Number of tasks (usually translate to processor cores) to use | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --ntasks=1 | #SBATCH --ntasks=1 | ||
</source> | </source> | ||
;Memory per cpu core. Default is megabytes, but units can be specified with M or G for megabytes or Gigabytes. | ;Memory per cpu core. Default is megabytes, but units can be specified with M or G for megabytes or Gigabytes. | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --mem-per-cpu=2G | #SBATCH --mem-per-cpu=2G | ||
Line 50: | Line 50: | ||
;Job run time in [DAYS]:HOURS:MINUTES:SECONDS | ;Job run time in [DAYS]:HOURS:MINUTES:SECONDS | ||
:[DAYS] are optional, use when it is convenient | :[DAYS] are optional, use when it is convenient | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --time=72:00:00 | #SBATCH --time=72:00:00 | ||
Line 56: | Line 56: | ||
;Optional: | ;Optional: | ||
:A group to use if you belong to multiple groups. Otherwise, do not use. | :A group to use if you belong to multiple groups. Otherwise, do not use. | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --account=<GROUP> | #SBATCH --account=<GROUP> | ||
</source> | </source> | ||
:A job array, which will create many jobs (called array tasks) different only in the '<code>$SLURM_ARRAY_TASK_ID</code>' variable, similar to [[Torque_Job_Arrays]] on HiPerGator 1 | :A job array, which will create many jobs (called array tasks) different only in the '<code>$SLURM_ARRAY_TASK_ID</code>' variable, similar to [[Torque_Job_Arrays]] on HiPerGator 1 | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
#SBATCH --array=<BEGIN-END> | #SBATCH --array=<BEGIN-END> | ||
Line 72: | Line 72: | ||
;Recommended convenient shell code to put into your job script | ;Recommended convenient shell code to put into your job script | ||
* If we're inside a job change to this directory instead of /home/$USER. | * If we're inside a job change to this directory instead of /home/$USER. | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
[[ -d $SLURM_SUBMIT_DIR ]] && cd $SLURM_SUBMIT_DIR | [[ -d $SLURM_SUBMIT_DIR ]] && cd $SLURM_SUBMIT_DIR | ||
</source> | </source> | ||
* Add host, time, and directory name for later troubleshooting | * Add host, time, and directory name for later troubleshooting | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
date;hostname;pwd | date;hostname;pwd | ||
Line 84: | Line 84: | ||
* Load the software you need | * Load the software you need | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
module load ncbi_blast | module load ncbi_blast | ||
Line 90: | Line 90: | ||
</source> | </source> | ||
* Run the program | * Run the program | ||
− | {{#fileAnchor: | + | {{#fileAnchor: run.sh}} |
<source lang=make> | <source lang=make> | ||
blastn -db nt -query input.fa -outfmt 6 -out results.xml | blastn -db nt -query input.fa -outfmt 6 -out results.xml |
Revision as of 00:50, 10 May 2016
HiPerGator 2.0 documentation |
This is a walk-through for a basic SLURM scheduler job script. 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.
Download raw source of the [{{#fileLink: run.sh}} run.sh] file.
- Set the shell to use
{{#fileAnchor: run.sh}}
#!/bin/bash
- Common arguments
- Name the job to make it easier to see in the job queue
{{#fileAnchor: run.sh}}
#SBATCH --job-name=<JOBNAME>
- Your email address to use for all batch system communications
{{#fileAnchor: run.sh}}
##SBATCH --mail-user=<EMAIL>
- What emails to send
- NONE - no emails
- ALL - all emails
- END,FAIL - only email if the job fails and email the summary at the end of the job
{{#fileAnchor: run.sh}}
#SBATCH --mail-type=FAIL,END
- Standard Output and Error log files
- Use file patterns
- %j - job id
- %A-$a - Array job id (A) and task id (a)
{{#fileAnchor: run.sh}}
#SBATCH --output <my_job-%j.out>
#SBATCH --error <my_job-%j.err>
- Number of tasks (usually translate to processor cores) to use
{{#fileAnchor: run.sh}}
#SBATCH --ntasks=1
- Memory per cpu core. Default is megabytes, but units can be specified with M or G for megabytes or Gigabytes.
{{#fileAnchor: run.sh}}
#SBATCH --mem-per-cpu=2G
- Job run time in [DAYS]
- HOURS:MINUTES:SECONDS
- [DAYS] are optional, use when it is convenient
{{#fileAnchor: run.sh}}
#SBATCH --time=72:00:00
- Optional
- A group to use if you belong to multiple groups. Otherwise, do not use.
{{#fileAnchor: run.sh}}
#SBATCH --account=<GROUP>
- A job array, which will create many jobs (called array tasks) different only in the '
$SLURM_ARRAY_TASK_ID
' variable, similar to Torque_Job_Arrays on HiPerGator 1
{{#fileAnchor: run.sh}}
#SBATCH --array=<BEGIN-END>
- Example of five tasks
- #SBATCH --array=1-5
- END OF PBS SETTINGS
- Recommended convenient shell code to put into your job script
- If we're inside a job change to this directory instead of /home/$USER.
{{#fileAnchor: run.sh}}
[[ -d $SLURM_SUBMIT_DIR ]] && cd $SLURM_SUBMIT_DIR
- Add host, time, and directory name for later troubleshooting
{{#fileAnchor: run.sh}}
date;hostname;pwd
Below is the shell script part - the commands you will run to analyze your data. The following is an example.
- Load the software you need
{{#fileAnchor: run.sh}}
module load ncbi_blast
- Run the program
{{#fileAnchor: run.sh}}
blastn -db nt -query input.fa -outfmt 6 -out results.xml
date