Skip to content
Snippets Groups Projects
README.md 2.64 KiB
Newer Older
Mike Smith's avatar
Mike Smith committed
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.

Mike Smith's avatar
Mike Smith committed
# Intro

Teaching material used during the High Performance Computing session of the EMBL Software Carpentry course.

# Commands

Below are most of the commands used during the practical, so they can be copy/pasted, but I highly recommend typing along if you can.

Mike Smith's avatar
Mike Smith committed
## Login to the frontend node

```
ssh <username>@login.cluster.embl.de
```

## Clone this git repository
```
git clone https://git.embl.de/msmith/embl_hpc.git
```

Mike Smith's avatar
Mike Smith committed
## Identifying our computer

```
hostname
```

## Our first SLURM job

```
srun hostname
```

Mike Smith's avatar
Mike Smith committed
## Exploring our example program (don't run!)
Mike Smith's avatar
Mike Smith committed
cd $HOME/embl_hpc/exercises
./hpc_example -t 10 -m 100
Mike Smith's avatar
Mike Smith committed
```

## Running example program on on the cluster

```
Mike Smith's avatar
Mike Smith committed
srun ./hpc_example -t 10 -m 100
```

## Using our reserved training space
```
srun --­­reservation=training ./hpc_example -­t 10 -­m 100
Mike Smith's avatar
Mike Smith committed
```

## Running in the background

```
Mike Smith's avatar
Mike Smith committed
sbatch ­­--reservation=training ./batch_job.sh
Mike Smith's avatar
Mike Smith committed
```

## Redirecting output

```
Mike Smith's avatar
Mike Smith committed
sbatch --output=output.txt --reservation=training ./batch_job.sh
Mike Smith's avatar
Mike Smith committed
```

## Creating a larger list
Mike Smith's avatar
Mike Smith committed
You will need to edit batch_jobs.sh to take arguments
Mike Smith's avatar
Mike Smith committed
```
Mike Smith's avatar
Mike Smith committed
sbatch --output=output.txt --reservation=training ./batch_job.sh 20 ???
Mike Smith's avatar
Mike Smith committed
```

## Displaying details of our cluster queue

```
scontrol show partition
```

## Requesting more resources

```
Mike Smith's avatar
Mike Smith committed
sbatch --mem=8200 --reservation=training ./batch_job.sh 30 8000
Mike Smith's avatar
Mike Smith committed
```

## Requesting a lot more resources

```
Mike Smith's avatar
Mike Smith committed
sbatch --mem=100G --reservation=training ./batch_job.sh 30 5000
```

## Cancel jobs
```
scancel <jobID>
scancel -u <username>
```

## Defining time limits
```
sbatch ­­--time=00­00:00:30  \
    ­­--reservation=training \
    batch_job.sh 60 500
```

## Job efficiency statistics
```
seff <jobID>
```

## Emailing output
```
sbatch ­­--mail­user=<first.last>@embl.de \
    ­­--reservation=training \
    ./batch_job.sh 20 500
```

## Finding and using software
```
module avail
module spider samtools
module load BWA
```

## BWA example
```
nano bwa/bwa_batch.sh
sbatch ­­­­--reservation=training bwa/bwa_batch.sh
Mike Smith's avatar
Mike Smith committed
```

## Running interactive jobs
```
srun --pty bash
```

## Interactive job with more memory
```
srun --mem=250 --pty bash
```

## Using `sbatch` instead

```
sbatch batch_jobs.sh
```

## Using job dependencies to build pipelines

```
jid=$(sbatch --parsable batch_job.sh)

sbatch --dependency=afterok:$jid batch_job.sh
```