Hamilton in a nutshell


Hamilton schematic

Getting ssh client software

On Linux laptops, use your package manager to install openssh.

On Windows, there are many programs, a popular one is putty.

Copying a file from your laptop to hamilton

scp myfile username@hamilton.dur.ac.uk:

Copying a file from hamilton to your laptop

scp username@hamilton.dur.ac.uk:/ddn/home/username/somedirectory/remotefile .

Using the terminal

Getting help with commands

Most commands in linux come with a manpage manual. To get information on how to use e.g. cd

man cd

This will open up a terminal reader (scroll up and down with arrow keys, exit with q).

Useful linux commands

  • pwd
  • cd
  • ls
  • mv
  • rm
  • cp
  • mkdir

  • less
  • cat
  • head
  • tail

  • hostname
  • whoami
  • who
  • groups

Editing files

There are many ways to do that.

Remote editors

There are some standard editors available that work in a terminal:

  • nano — that one is simple and intuitive
  • vi or vim — very powerful but not easy
  • emacs — also very powerful

Local editors

Non-elegant solution

  • Edit files on you laptop with your favourite editor
  • save changes
  • Use scp to copy your files to hamilton

Elegant solution 1

  • Mount a remote (i.e. at hamilton) directory to your local laptop with e.g. sshfs

I do this sort of thing regularly on my laptop:

mkdir /tmp/myremotedir
sshfs username@hamilton.dur.ac.uk:/ddn/home/somedirectory  /tmp/myremotedir

I then have access to the remote files in /ddn/home/somedirectory as if they were on my laptop in the path /tmp/myremotedir.

To close the connection, use

fusermount -u /tmp/myremotedir

Elegant solution 2

Editors such as Visual Studio Code allow to create and edit files on remote machines. For example, the Remote-SSH extension allows that.

Once the extension is installed, you can use the Remote explorer to add a SSH Target to hamilton and activate it.

The module command

A lot of software is available through module:

module av
module available
module av gcc

See what is currently loaded

module li
module list

Load a module

module load gcc/9.3.0

Unload a module

module unload gcc/9.3.0

Swap a module

module load gcc/9.3.0
module swap gcc/9.3.0 intel/2020.4

Clear all modules

module purge

SLURM

SLURM submission works via scripts, i.e. short textfiles that contain information on:

Queues

Hamilton provides several queues that jobs can be submitted to (see sinfo). Most useful are:

  • test.q
  • par7.q

Simple example

This is the content of the file job.sh:

#!/bin/bash             
#SBATCH -t 5            # Request 5 minutes of time
#SBATCH -p test.q       # This selects machines from the queue test.q
#SBATCH -N 1            # We want just one compute node
#SBATCH --mail-type=END # We want an email notification at the end of the job
#SBATCH --mail-user=username@durham.ac.uk # The email notification goes to this address


echo "Hello world from  ${SLURM_JOB_NODELIST} at ${PWD}"
echo

# Get rid of all currently loaded modules and only load gcc 9.3
module purge
module load gcc/9.3.0

# This is the command we run
lscpu

To submit do:

sbatch job.sh

This will give you a message similar to

Submitted batch job 4489750

To check on the status of you job use squeue -u username or scontrol show job 4498750.

Stdout and Stderr streams are captured in the files slurm-4489750.out and slurm-4489750.err

Things to know

By default, execution is relative to the directory where you call sbatch from. This is particularly important when you deal with input/output files.

Software enrironments are inhereted by default when using sbatch.

The compute nodes have slightly different hardware compared to the login nodes.

Useful slurm commands

  • sinfo
  • sbatch
  • squeue
  • scancel
  • scontrol

Hamilton network configuration

The image below shows how the individual nodes are connected to each other.