User Tools

Site Tools


guides:slurm:basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
guides:slurm:basics [08.10.2019 15:26]
Juha Kekäläinen
guides:slurm:basics [27.11.2023 12:40] (current)
Administrator
Line 11: Line 11:
  
 {{ :guides:slurm:slurm.png |}} {{ :guides:slurm:slurm.png |}}
 +
  
 ### Example ### Example
 +
 +In this example we will run simple [MATLAB](https://www.mathworks.com/products/matlab.html) code on one computing node.
 +
 +
 #### Example MATLAB code (matlab.m) #### Example MATLAB code (matlab.m)
 ``` ```
Line 20: Line 25:
 ``` ```
 #### Example script (submit.sbatch) #### Example script (submit.sbatch)
 +
 +Here we have specified the [batch script](https://slurm.schedmd.com/sbatch.html) with few basic [options](https://slurm.schedmd.com/sbatch.html#lbAG). It is important to reserve the amount of RAM that you'll need and estimate the runtime of your code. Optionally you can give name for your job.
 +
 ``` ```
  
 #!/bin/bash #!/bin/bash
 +#SBATCH --ntasks 1 # Number of task
 +#SBATCH --time 5 # Runtime in minutes.
 +#SBATCH --mem=2000 # Reserve 2 GB RAM for the job
 +#SBATCH --partition serial # Partition to submit
  
-module load matlab/R2018b # load modules+module load matlab/R2022b # load modules
  
 matlab -nodisplay < matlab.m # Execute the script matlab -nodisplay < matlab.m # Execute the script
Line 35: Line 47:
 sbatch submit.sbatch sbatch submit.sbatch
 ``` ```
-**[sbatch](https://slurm.schedmd.com/sbatch.html)** command submits the job to the job queue and executes the **[bash script](https://en.wikipedia.org/wiki/Bash_(Unix_shell)**. Output of the job can be found from the local output file.+**[sbatch](https://slurm.schedmd.com/sbatch.html)** command submits the job to the job queue and executes the **[bash script](https://en.wikipedia.org/wiki/Bash_(Unix_shell)**.  
 + 
 +Here is an another example on how to analyze variants.
  
 ``` ```
-less slurm-<jobid>.out+#!/bin/bash 
 +#SBATCH --ntasks 1          # Number of task 
 +#SBATCH --time 00:30:00     # Runtime 30min 
 +#SBATCH --mem 2000          # Reserve 2 GB RAM for the job 
 +#SBATCH --partition serial  # Partition to submit 
 + 
 +module load bcftools # load modules 
 + 
 +# filter variants and calculate stats 
 +bcftools filter --include'%QUAL>20' calls.vcf.gz | bcftools stats --output calls_filtered.stats 
 ``` ```
 +
 +Submit the job to computing queue with the **[sbatch](https://slurm.schedmd.com/sbatch.html)** command.
 +
 +```
 +sbatch variants.sbatch
 +```
 +
  
 ### Slurm job queue ### Slurm job queue
-User can monitor the progress of the job with the **[squeue](https://slurm.schedmd.com/squeue.html)** command. JOBID is provided by the sbatch commmand when the job is submitted.+User can monitor the state of the job with the **[squeue](https://slurm.schedmd.com/squeue.html)** command. JOBID is provided by the sbatch commmand when the job is submitted.
  
 ``` ```
 squeue -j <jobid> squeue -j <jobid>
 +```
 +
 +### Output of the job is available in local output file.
 +
 +```
 +less slurm-<jobid>.out
 ``` ```
  
Line 69: Line 105:
 ``` ```
 scontrol show job <jobid> scontrol show job <jobid>
-``` 
- 
-#### Extend runtime of given jobid 
- 
-``` 
-scontrol update jobid=<job_id> TimeLimit=<new_timelimit> 
 ``` ```
  
guides/slurm/basics.1570537611.txt.gz · Last modified: 29.10.2019 15:10 (external edit)