README.md 2.83 KB
Newer Older
Mike Smith's avatar
Mike Smith committed
1
2
<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
3
4
# Intro

Toby Hodges's avatar
Toby Hodges committed
5
6
7
8
9
Teaching material for an introductory cluster computing course at EMBL.

Branches:

- `master`: material for the EMBL-internal Bio-IT course, _Introduction to Cluster Computing at EMBL_
Toby Hodges's avatar
Toby Hodges committed
10
- `swc-hpc`: material for the HPC session of [Software Carpentry](https://software-carpentry.org/) workshops run at EMBL
Mike Smith's avatar
Mike Smith committed
11

12
# Commands (for EMBL Cluster)
Mike Smith's avatar
Mike Smith committed
13
14
15

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
16
17
18
19
20
21
22
23
## Login to the frontend node

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

## Clone this git repository
```
Toby Hodges's avatar
Toby Hodges committed
24
git clone https://git.embl.de/grp-bio-it/embl_hpc.git
Mike Smith's avatar
Mike Smith committed
25
26
```

Mike Smith's avatar
Mike Smith committed
27
28
29
30
31
32
33
34
35
36
37
38
## Identifying our computer

```
hostname
```

## Our first SLURM job

```
srun hostname
```

Mike Smith's avatar
Mike Smith committed
39
## Exploring our example program (don't run!)
Mike Smith's avatar
Mike Smith committed
40
41

```
Mike Smith's avatar
Mike Smith committed
42
43
cd $HOME/embl_hpc/exercises
./hpc_example -t 10 -m 100
Mike Smith's avatar
Mike Smith committed
44
45
46
47
48
```

## Running example program on on the cluster

```
Mike Smith's avatar
Mike Smith committed
49
50
51
52
53
srun ./hpc_example -t 10 -m 100
```

## Using our reserved training space
```
Toby Hodges's avatar
Toby Hodges committed
54
srun --reservation=training ./hpc_example -t 10 -m 100
Mike Smith's avatar
Mike Smith committed
55
56
57
58
59
```

## Running in the background

```
Toby Hodges's avatar
Toby Hodges committed
60
sbatch --reservation=training ./batch_job.sh
Mike Smith's avatar
Mike Smith committed
61
62
63
64
65
```

## Redirecting output

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

## Creating a larger list
Mike Smith's avatar
Mike Smith committed
70
You will need to edit batch_jobs.sh to take arguments
Mike Smith's avatar
Mike Smith committed
71
```
Mike Smith's avatar
Mike Smith committed
72
sbatch --output=output.txt --reservation=training ./batch_job.sh 20 ???
Mike Smith's avatar
Mike Smith committed
73
74
75
76
77
78
79
80
81
82
83
```

## Displaying details of our cluster queue

```
scontrol show partition
```

## Requesting more resources

```
Mike Smith's avatar
Mike Smith committed
84
sbatch --mem=8200 --reservation=training ./batch_job.sh 30 8000
Mike Smith's avatar
Mike Smith committed
85
86
87
88
89
```

## Requesting a lot more resources

```
Mike Smith's avatar
Mike Smith committed
90
91
92
93
94
95
96
97
98
99
100
sbatch --mem=100G --reservation=training ./batch_job.sh 30 5000
```

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

## Defining time limits
```
Toby Hodges's avatar
Toby Hodges committed
101
102
sbatch ­­--time=00 00:00:30  \
      --reservation=training \
Mike Smith's avatar
Mike Smith committed
103
104
105
106
107
108
109
110
111
112
    batch_job.sh 60 500
```

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

## Emailing output
```
Toby Hodges's avatar
Toby Hodges committed
113
sbatch ­­--mail-user=<first.last>@embl.de \
Mike Smith's avatar
Mike Smith committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    ­­--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
Toby Hodges's avatar
Toby Hodges committed
128
sbatch --reservation=training bwa/bwa_batch.sh
Mike Smith's avatar
Mike Smith committed
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
```

## 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
```