Skip to content

Commit 772df34

Browse files
committed
Multiple minor edits made following teaching the course
1 parent e714246 commit 772df34

File tree

8 files changed

+81
-23
lines changed

8 files changed

+81
-23
lines changed

1_Introduction_and_setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The course has three parts. The first introduces the concept of a “compute cl
7474

7575
# Cluster Computing
7676
## What is a compute (or computer) cluster?
77-
A compute cluster is a set of computers that work together so that they can be regarded as a single entity. These inter-connected computers (known as nodes) run software to coordinate the running of programs across the system. The diagram below gives an overview of a compute cluster.
77+
A compute cluster is a set of computers that work together so that they can be regarded as a single entity. These inter-connected computers (known as nodes, a sometime blades) run software to coordinate the running of programs across the system. The diagram below gives an overview of a compute cluster.
7878

7979
![Figure 1 - Compute cluster schematic](assets/cluster_computing_schematic.png)
8080
Figure 1 - Compute cluster schematic

3_Cluster_Computing.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ All scripts you write should start with the line: `#!/bin/bash`. This makes it
112112

113113
The second line is the command you wish to run, which if you remember from before will print “Hello World!” to the screen.
114114

115-
To execute this Bash script on the head node, type:
115+
To execute this Bash script **on a head node**, type:
116116

117117
bash test.sh
118118
Hello World!
119119

120120
(Although we are discussing how to submit jobs to the cluster in this section, it is certainly worth knowing that Bash commands can be written to files in this way and subsequently run. Doing this can save users a lot of time entering the same commands over-and-over again into the command line.)
121121

122-
So, this has had the same effect as simply entering the echo Hello World! on the command line. Now, in this example, we pass this script to the `sbatch` command to submit the job to a compute node.
122+
So, this has had the same effect as simply entering the echo Hello World! on the command line. Now, in this example, we pass this script to the `sbatch` command to submit the job **from a head node to a compute node**.
123123

124124
sbatch test.sh
125125
Submitted batch job 2444919
@@ -164,8 +164,12 @@ Passing a bash script to `sbatch` is one way to run a non-interactive job on the
164164
#SBATCH --job-name=test_job
165165
#SBATCH --cpus-per-task=c
166166
#SBATCH --mem=2G
167-
#SBATCH --mail-type=ALL
168-
#SBATCH --mail-user=$USER@mrc-lmb.cam.ac.uk
167+
#SBATCH --mail-user=john_smith@mrc-lmb.cam.ac.uk
168+
#SBATCH --mem=30G
169+
170+
# Bash command
171+
module load R/4.5.1
172+
Rscript norm_dist_1_billion.R
169173

170174
# Bash commands
171175
echo Hello World!
@@ -174,14 +178,16 @@ The first line of the script tells the cluster to use the bash shell. The lines
174178

175179
1. the shell we wish to use
176180

177-
2. the sbatch parameters
181+
2. the `sbatch` parameters
178182

179-
2) the contents of the bash script.
183+
3) the contents of the bash script.
180184

181-
To run the slurm script, enter:
185+
To run the slurm script, enter **on the head node**:
182186

183187
sbatch test.slurm
184188

189+
**Please note that the variable `$USER` will not be interpreted inside a Slurm script, and so you will need to enter your actual LMB email address.**
190+
185191
### A note on exit codes
186192
At various points when using the cluster, you may see the term "exit code" reported. What does this mean?
187193

@@ -345,6 +351,30 @@ Visual Studio Code allows users to connect to the cluster (even from outside the
345351
The software can be downloaded from:
346352
https://code.visualstudio.com/
347353

354+
We shall not discuss how to use VS Code in detail here, and in any case, the manufacturers of the software produce a good training video at: https://code.visualstudio.com/docs/introvideos/basics
355+
356+
To connect to the software to the cluster, you will also need to install the extension "Remote - SSH" from the VS Code marketplace. Click on the marketplace icon in the left-hand side menu to do this.
357+
358+
You will also need to specify your login credentials to access the server. The best way to do this is to access the Command Palette (<kbd>Shift</kbd> + <kbd>Command</kbd> + <kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> (Windows/Linux) and then select `Remote-SSH: Open SSH Configuration File...` Then, from the drop-down menu, select the configuration file that is located in your home directory. Then enter the setup listed below (replacing "your_username" with your actual cluster username):
359+
360+
Host hal_on_site
361+
HostName hal
362+
User your_username
363+
364+
Host hal_external
365+
HostName hal
366+
User your_username
367+
IdentityFile ~/.ssh/hal
368+
ProxyCommand ssh -q -W %h:%p atg.mrc-lmb.cam.ac.uk
369+
370+
This is the setup for accessing the cluster from inside the LMB network, and from outside via `atg`
371+
372+
Having setup your login credentials, you can access the cluster by activating the command palette once more and then selecting:
373+
374+
`Remote-SSH: Connect current window to host...`
375+
376+
Then choose the relevant host and enter your password / verification ID.
377+
348378
## R Studio Server
349379
It is possible to run R Studio on the cluster via a web interface. Open your internet browser (e.g. Google Chrome) and then go to:
350380

presentation.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,6 @@ table {
540540
---
541541

542542
# Homework! ;-)
543-
544-
* Download and install Visual Studio Code: https://code.visualstudio.com
545-
546-
* Access the cluster via Visual Studio Code
547-
548-
* Create and edit files using Visual Studio Code
549543

550544
* Try accessing the cluster from outside the LMB via **atg**: https://www.mrc-lmb.cam.ac.uk/scicomp/index.php?id=ssh-x2go
551545

@@ -569,6 +563,31 @@ table {
569563

570564
---
571565

566+
* Command palette
567+
568+
* <kbd>Shift</kbd> + <kbd>Command</kbd> + <kbd>P</kbd> (Mac)
569+
570+
* <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> (Windows/Linux)
571+
572+
* `Remote-SSH: Open SSH Configuration File...`
573+
574+
Host hal_on_site
575+
HostName hal
576+
User your_username
577+
578+
Host hal_external
579+
HostName hal
580+
User your_username
581+
IdentityFile ~/.ssh/hal
582+
ProxyCommand ssh -q -W %h:%p atg.mrc-lmb.cam.ac.uk
583+
---
584+
585+
* `Remote-SSH: Connect current window to host...`
586+
587+
* https://code.visualstudio.com/docs/introvideos/basics
588+
589+
---
590+
572591
# Part II
573592
## Using the Cluter Compute Nodes (hours 4-8)
574593

@@ -650,7 +669,7 @@ table {
650669
echo Sleeping!
651670
sleep 100
652671

653-
* Execute script:
672+
* Execute script **on a head node**:
654673

655674
bash test.sh
656675
Sleeping
@@ -659,7 +678,7 @@ table {
659678

660679
## Submitted jobs (2) [demo]
661680

662-
* Submit script to queue:
681+
* Submit script to queue **on a head node**:
663682
`sbatch test.sh`
664683

665684
---
@@ -701,19 +720,19 @@ table {
701720
---
702721

703722
## Submitted jobs (5) [demo]
704-
Slurm scripts:
723+
Slurm scripts (actual email needed):
705724

706725
#!/bin/bash
707726
#SBATCH --job-name=test_job
708727
#SBATCH --cpus-per-task=1
709728
#SBATCH --mem=2G
710729
#SBATCH --mail-type=ALL
711-
#SBATCH --mail-user=$USER@mrc-lmb.cam.ac.uk
730+
#SBATCH --mail-user=john_smith@mrc-lmb.cam.ac.uk
712731

713732
# Bash commands
714733
echo Hello World!
715734

716-
Run as:
735+
Run **on a head node**:
717736
`sbatch test.slurm`
718737

719738
---
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@
2727
* Text editor
2828
* Terminal
2929
* FTP
30+
31+
32+
** Leave at least half an hour after participants have attempted Exercise 6 to wrap up the course **

tutor_notes/norm_dist.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
Rscript norm_dist_1_billion.R

tutor_notes/pre_course_email.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ https://bb8.mrc-lmb.cam.ac.uk/userdash
88

99
Log in with your LMB credentials, then click the "slurm" link in the "Additional" section and click the confirmation button.
1010

11+
Also, check in this section that the "Shell" is: "/bin/bash". If it is not, then please email Scientific Computing and ask them to change your default shell to "Bash".
12+
1113
**Software**
1214

1315
Please bring your own laptop to the course, which should be running a recent version of Windows or macOS. Please install recent versions of the following software before attending the course:
@@ -18,10 +20,14 @@ FileZilla Client - https://filezilla-project.org/
1820

1921
Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
2022

23+
Visual Studio Code: https://code.visualstudio.com
24+
2125
*macOS:*
2226

2327
FileZilla Client - https://filezilla-project.org/
2428

29+
Visual Studio Code: https://code.visualstudio.com
30+
2531
**Network Access**
2632

2733
Please make sure you bring a machine that can already connect to the LMB intranet via wi-fi (not the “Guest” network).

tutor_notes/sleep.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
Rscript norm_dist_1_billion.R
2+
echo Sleeping!
3+
sleep 100

tutor_notes/test.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)