Day 9: Setup environment for advanced courses

If you attend Biosimulations or Machine Learning skip this.

Setup the access

For some of the advanced courses, First principles and Mesoscale, we will use a remote cluster at Science and Technology Facilities Council, scarf.rl.ac.uk. In order to make things easy please setup your accounts. These are instructions for your virtual machine. Similar instructions can be used for normal linux machines, Apple or Windows with bash shell.

  • step 0: create ~/.ssh folder if does not exist by generating a set of keys.

ssh-keygen

answer by hitting enter all the questions

Generating public/private rsa key pair.
Enter file in which to save the key (/home/jovyan/.ssh/id_rsa):
Created directory '/home/jovyan/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jovyan/.ssh/id_rsa
Your public key has been saved in /home/jovyan/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:VwWqWydvs3E...............
The key's randomart image is:
+---[RSA 3072]----+
|            ...  |
|           . .   |
|          . . E .|
|         ...   ..|
|        S +oo   .|
|         +=B  .oo|
|        .oo+B.+B*|
|        ...++@+=O|
|       .. o+ooX*o|
+----[SHA256]-----+
  • step 1: copy the key emailed into the folder (tmpXY, replace XY with your number)

cp tmpXY ~/.ssh/
chmod 600 ~/.ssh/tmpXY
  • step 2: create a config file with your favourite edirot ~/.ssh/config and add the following lines in it

Host scarf
  Hostname ui1.scarf.rl.ac.uk
  User tmpXY
  IdentityFile ~/.ssh/tmpXY
  • step 3: test you can login (you will need the passphrase provided)

ssh scarf

Submitting jobs

Scarf uses slurm to submit jobs. Please do not run any computational intensive job on the login node.

To submit a job you will need a specially crafted script. You can find an example in /work4/training/ccp5/job.slurm. The content will look like

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --exclusive
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=1
#SBATCH -C scarf21
#SBATCH --reservation=ccp5
#SBATCH -t 00:10:00

echo "Hello world"

Line 3 tells you how many cores you are asking for via -n, Line 4 request exclusive access to the node. On Line 5 we specify the time we would like the resources to be ours and Line 6 will select a special part of the cluster which is reserved for the school. Starting with Line 7 you can type what you need to do as you type in the terminal line but in a script.

Running the script

cp /work4/training/ccp5/job.slurm ~/
cd ~/
sbatch job.slurm

you shall see something like

Submitted batch job 1326596

The last number is your job id. If your job will output on the screen slurm redirects all that in a file called slurm-<jobid>.out. check for your job output and see what you have obtained.

Seeing jobs

to see all the jobs running on the cluster use

squeue

to see only your jobs

squeue -u $USER

Deleting a job

scancel jobid

now you shall be all setup for advanced classes. Enjoy!