forked from aebratt/qermserver-hyak-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresentation.Rmd
More file actions
449 lines (292 loc) · 11.1 KB
/
presentation.Rmd
File metadata and controls
449 lines (292 loc) · 11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
---
title: "Cloud Computing and Remote Servers"
author: "Abby Bratt and Hannah Sipe"
date: "February 3, 2021"
output:
ioslides_presentation:
incremental: yes
widescreen: yes
header-includes:
- \usepackage{tikz}
- \usepackage{pgfplots}
- \usepackage{verbatim}
- \usepackage{textcomp}
- \usetikzlibrary{shapes,arrows}
---
<!-- General Outline: -->
<!-- Both (30m) - Intro to how a computer works and parallelization -->
<!-- Hannah (30m) - Cloud computing -->
<!-- Abby (30m) - Hyak -->
# Remote Servers: Why Bother?
<!-- I (Abby) think it would be good to say something about code profiling also -->
<!-- And thinking through when your code is memory intensive vs. cpu intensive, how a computer works, etc -->
## A note about GitHub
Switch to SSH authentication before August 2021
Chapter 11 of Happy Git with R
## The Basics: How Do Computers Work?
- Computation: CPUs
- Each CPU has 1 or more cores
- Each core can do 1 computation at a time
- Theoretical top speed = all cores active
- Reality: cores need to communicate
- Memory: RAM vs. not-RAM
- RAM is volatile, extremely fast, low-volume
- Hard drive (ex. SSD) is persistent, fairly slow, high-volume
- Sidenote: GPUs and CUDA
- Each GPU holds 100s or 1000s of ''CUDA cores''
- Each CUDA core is very small
- Very fast for ''embarassingly parallel'' problems
## ''Why is my code so slow''
- The most common cases are:
- You've run out of RAM
- Your computer just has too many operations to do
- ''How do I make it faster''
- Run it on a bigger computer with more RAM
- Run it on a bigger computer with more cores
- Solution: use a remote server!
- can generally run more FLOPS (floating point operations per second) than
your laptop
- allows more opportunities for parallelization
## Parallel and "embarassingly" parallel
<div class="centered">
{width=500px}
- Most of what we do that is most computation intensive (e.g. simulating data, running multiple MCMC chains) are embarassingly parallel problems because they are independent (i.e. there is no information shared between processes)
- See README for some resources on parallelization in JAGS, NIMBLE, and R
## (Dis)advantages of parallelization
\(N\) cores may save you time up to a factor of \(N\), but:
- only if you efficiently distribute computation between cores (not relevant to us, generally)
- only if the programmer-time it takes is relatively small
## (Dis)advantages of parallelization
<div class="centered">
{width=500px}
## Recap: Why use a remote server?
- Lots of CPUs and RAM available
- Doesn't slow down your personal computer
- Feel like a pro, brag to your friends
## Review
- When should you parallelize?
- When should you definitely not parallelize?
- When should you use a remote server?
## What are our needs?
- What have folks used? How was your experience?
- Do you have computing needs that are not being met?
## What options are available to us?
- pay-per-use
- Amazon, Google cloud, Azure, etc
- free (for students)
- SAFS/QERM/SEFS servers
- Hyak
# HANNAH SLIDES GO HERE
# How to Access the QERM/SEFS/SAFS Servers
## skipping this today
We are pretty sure everyone in the lab has successfully gotten onto these but if not, there are some resources in the README
# How to Access Hyak
<!-- Outline: -->
<!-- 1. What is hyak? -->
<!-- 2. How does hyak work? -->
<!-- 3. How to log in -->
<!-- 4. How to upload files -->
<!-- 5. How to write a batch script (things you submit to slurm) -->
<!-- 6. How to submit a job -->
<!-- 6bonus - wait, what if I need a special library or piece of software? -->
<!-- 7. How to check what's happening in the queue -->
<!-- 8. How to download finished results -->
<!-- 9. How to game slurm (requesting memory, etc strategically so you get high priority) -->
<!-- 10. Where do get help doing things more advanced than this (multinode stuff, working in languages that need to be compiled, etc) -->
## What is hyak?
Hyak is a word in Chinook Jargon, meaning "fast." Chinook Jargon is the trade language of the Pacific Northwest, incorporating terms from Chinook and Chehalis and other local languages, as well as French and English. We've chosen words from Chinook Jargon for the names of systems in the UW research cyber infrastructure to emphasize their role in supporting the broad range of UW research users and our ties to our place between the mountains and Salish Sea.
--UW IT Connect
## What is hyak?
Hyak is part of an integrated, scalable, scientific super-computing infrastructure operated by UW-IT. It includes the lolo tapearchive system, a high-performance research network, **the Hyak compute infrastructure (the HPC clusters)**, and any scientific support services on making this useful in your research workflows.
--UW IT Connect
## How does hyak work?
Within hyak, **mox** is a supercomputing **cluster**.
A **cluster** is a set of connected computers, **nodes**, that work together in a single system.
In general, **clusters** are faster and more capable than a single computer or even several disconnected computers.
--UW Research Computing Club
## How does hyak work?
On mox, labs or groups can buy groups of nodes called **partitions**. The Research Computing Club applied for a big grant from the Student Technology Fee fund (that we all pay into every quarter!) to purchase nodes accessible to all students.
If you want to vote on how these dollars get allocated, you can submit proposals or endorse others' proposals on the uwstf website https://uwstf.org/proposals/
## How does hyak work?
* In general, the compute nodes have the following specs:
- 28 cores
- 128 GB RAM
* The STF partition is currently 92 regular nodes, plus some interactive and GPU nodes.
* That's a lot
## How does hyak work?
<!-- structure goes here -->
* Login nodes (mox1, mox2)
* Have internet
* Use these to upload/download files and submit jobs
* They are slow so __don't__ do heavy processing
* Build nodes (n#####)
* Have internet
* Don't get to take a whole node (so also kinda slow)
* Just for compiling software
* Compute nodes (n#####)
* No internet
* Where your jobs run
## Visually, this looks like:
<div class="centered">
{width=500px}
</div>
## How do I log in?
First, there are some resources on the README that describe how to join the RCC. You have to pass a short quiz and attend 1 meeting per year.
All nodes share the same file system.
Open a terminal window. Type
```
ssh UWNETID@mox.hyak.uw.edu
```
Follow two-factor authentication instructions.
You're in!
## It should look like this...
<div class="centered">
{width=600px}
</div>
<!-- Only works if you have access to Hyak, of course! -->
## Exercise
Log in!
## Important locations
* /gscratch/stf
* Main work location for stf users
* Any files untouched for >30 days will be scrubbed!!
* /usr/lusers/<username>
* Home directory
* Only 10 GB of storage per user
* /tmp
* Node local storage
## How do I upload files?
From GitHub:
```
git clone https://github.com/aebratt/qermserver-hyak-tutorial.git
```
From your computer:
```
scp filename UWNETID@mox.hyak.uw.edu:/path/to/destination/directory
```
## Exercise
Clone the git repo for this class to **your** scratch directory
## Exercise
Clone the git repo for this class to **your** scratch directory
**Hint:**
From login
```
cd /gscratch/stf
mkdir ./UWNETID
cd ./UWNETID
git clone https://github.com/aebratt/qermserver-hyak-tutorial.git
cd REPO-NAME
```
**Bonus:**
Why use the scratch directory?
## What is a batch script?
* Place to:
- Define all the options for a job you submit to the queue
- Set up environment (e.g. load modules)
- Run!
* Syntax:
- Comment using ##
- Set option using #SBATCH
## How do I write a batch script?
Short answer: don't.
Modify a template! Here's one:
```
vim Hyak_simple_batch.sh
```
Or open this file in your favorite text editor
## It should look like this...
<div class="centered">
{width=600px}
</div>
## Exercise
Submit a job to the queue!
## Exercise
Submit a job to the queue!
**Hint:**
First, open vim or another text editor and replace UWNETID in Hyak_simple_batch.sh
```
cd /gscratch/stf/UWNETID/qermserver-hyak-tutorial
sbatch -p stf -A stf Hyak_simple_batch.sh
```
## Wait, what if I need some special library or software?
You can do that! For R libraries,
```
mkdir /gscratch/stf/UWNETID/rpackages
srun -p build --time=2:00:00 --mem=10G --pty /bin/bash
```
We just created a directory for storing installed packages and got a session on an **interactive** build node.
## Wait, what if I need some special library or software?
Open the command line
```
module load r_3.6.0
module list
R
install.packages("PACKAGENAME", lib="/gscratch/stf/UWNETID/rpackages")
```
Choose a mirror somewhere on the west coast and press enter.
## Exercise
Submit a more complicated job to the queue!
**Hint:**
First, open vim or another text editor and replace UWNETID in Hyak_complicated.R and Hyak_complicated_batch.sh
```
exit
cd /gscratch/stf/UWNETID/qermserver-hyak-tutorial
sbatch -p stf -A stf Hyak_complicated_batch.sh
```
## When will my jobs run?
See the whole stf partition queue this way:
```
squeue -p stf
```
See just your jobs this way:
```
squeue -p stf -u UWNETID
```
You can also try:
```
sstat -j JOBID-RUNNING
sacct -j JOBID-COMPLETED
```
## Oops, I made a mistake!
Cancel jobs with
```
scancel JOBID#
```
## My job finished! How do I download my results?
From Hyak to GitHub:
```
git add filename
git commit -m "informative commit message"
git push
```
From Hyak to your computer:
```
scp UWNETID@mox.hyak.uw.edu:/path/to/file .
```
## How can I get higher priority?
You can check the priority of queued jobs with
```
sprio -p stf
```
How to interpret?
It may look something like
<div class="centered">
{width=600px}
</div>
## How can I get higher priority?
* **TRES**: Trackable RESources (TRES) are things like cpu, memory, nodes. The more a given TRES Type is requested/allocated on a job, the greater the job priority will be for that job. Mox cares about cpu (i.e. high CPU gets high priority)
* **Fair-share**: The fair-share component to a job's priority influences the order in which a user's queued jobs are scheduled to run based on the portion of the computing resources they have been allocated and the resources their jobs have already consumed. High priority to under-serviced accounts.
* Do not specify a walltime way longer than your job needs.
* Specify your memory! For 128G nodes use --mem=120G or less. The operating system requires some.
## What else can I do?
* Use the checkpoint queue - run your code on other groups' unused resources
* Install and build new software
## Where do I get help?
If you have trouble or you want to do more advanced stuff, check out
```
man SLURMCOMMAND
```
If all else fails, try
* Research Computing Club
* eScience Institute
* UW IT