University of Cambridge’ HPC
Table of Contents
- Getting an Account
- SSH Configuration
- Environment
- Installing ISSM on University of Cambridge’ HPC
- Cluster Class Settings
- Running Jobs on University of Cambridge’ HPC
Getting an Account
Request a University of Cambridge Research Computing Services account.
SSH Configuration
Add the following lines to ~/.ssh/config on your local machine if are not on the campus network,
Host camhpc darwin login.hpc.cam.ac.uk
HostName login.hpc.cam.ac.uk
User <USERNAME>
ProxyCommand ssh <USERNAME>@citadel.ch.cam.ac.uk nc %h %p 2> /dev/null
HostKeyAlias login.hpc.cam.ac.uk
replacing <USERNAME> with your University of Cambridge’ HPC username.
If you are on the campus network, you don’t need to go through citadel and you can log in directly:
Host camhpc darwin login.hpc.cam.ac.uk
HostName login.hpc.cam.ac.uk
User <USERNAME>
Then, you can ssh to University of Cambridge’ HPC with,
ssh camhpc
Password-less SSH
You can setup public key authentication in order to avoid having to input your password all the time you log onto University of Cambridge’ HPC. You need an SSH public/private key pair on your local machine. If you do not have one, you can create one by executing the following command on your local machine (no passphrase necessary; press Enter at each prompt to accept the defaults),
localhost$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users/username/.ssh/id_rsa.pub.
Two files are created:
- your private key
/Users/username/.ssh/id_rsa, and - the public key
/Users/username/.ssh/id_rsa.pub.
The private key must be kept private and never shared — keep its file permissions restricted (600). The contents of the public key need to be copied to ~/.ssh/authorized_keys on the remote machine,
localhost$ scp ~/.ssh/id_rsa.pub username@remotehost:~
Now, log onto University of Cambridge’ HPC and add the content of id_rsa.pub to ~/.ssh/authorized_keys,
remotehost$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
remotehost$ rm ~/id_rsa.pub
If you get an error message about /home/username/.ssh/authorized_keys: No such file or directory, you may need to create a .ssh directory first,
remotehost$ mkdir ~/.ssh
remotehost$ chmod 700 ~/.ssh
Environment
On University of Cambridge’ HPC, add the following lines to ~/.bashrc,
# Load modules
module load petsc/3.6.4
# ISSM
export ISSM_DIR=<PATH_TO_ISSM>
source $ISSM_DIR/etc/environment.sh
replacing <PATH_TO_ISSM> with the path to the directory that you cloned the ISSM source code repository to (note that this should be a subdirectory of /cluster/work/users/<USERNAME>/). Then, run,
source ~/.bashrc
or log out and log back in to apply this change.
Installing ISSM on University of Cambridge’ HPC
University of Cambridge’ HPC will only be used to run the code: you will use your local machine for pre- and post-processing; you will never use University of Cambridge’ HPC’ MATLAB.
Clone the ISSM source code repository on GitHub and install the following packages:
- autotools
- m1qn3
Follow the detailed instructions for compiling ISSM on Linux, and use the following configuration script (adapt to your needs),
#!/bin/sh
export CXXFLAGS="-DMPICH_IGNORE_CXX_SEEK -DMPICH_SKIP_MPICXX"
./configure \
--prefix="${ISSM_DIR}" \
--with-wrappers=no \
--with-kml=no \
--with-bamg=no \
--with-mpi-include="/usr/local/Cluster-Apps/intel/impi/4.1.3.045/include64" \
--with-mpi-libflags="-L/usr/local/Cluster-Apps/intel/impi/4.1.3.045/lib64 -lmpi" \
--with-mkl-libflags="-L/usr/local/Cluster-Apps/intel/mkl/10.3.10.319/composer_xe_2011_sp1.10.319/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm" \
--with-metis-dir="/usr/local/Cluster-Apps/petsc/3.6.4/intel12.1-impi" \
--with-petsc-dir="/usr/local/Cluster-Apps/petsc/3.6.4/intel12.1-impi" \
--with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" \
--with-mumps-dir="/usr/local/Cluster-Apps/petsc/3.6.4/intel12.1-impi"
Cluster Class Settings
In order to connect to University of Cambridge’ HPC from the machine that you are doing model setup and results analysis on, you will need to create a cluster class settings file for your chosen scripting interface.
Create $ISSM_DIR/src/m/camhpc_settings.m, which might include,
cluster.login='<USERNAME>';
cluster.partition='sandybridge';
cluster.project='ARNOLD-SL3';
cluster.port=0;
cluster.codepath='<PATH_TO_ISSM_ON_CLUSTER>/bin/';
cluster.executionpath='<PATH_TO_ISSM_ON_CLUSTER>/execution/';
cluster.numnodes=1;
cluster.cpuspernode=3;
cluster.time=2;
Cluster class camhpc.py still needs to be developed.
replacing <USERNAME> with your University of Cambridge’ HPC username and entering your code path and execution path. These settings will be picked up automatically by MATLAB when you run md.cluster=camhpc().
Running Jobs on University of Cambridge’ HPC
On University of Cambridge’ HPC, the more nodes and the longer the requested time, the more you will have to wait in the queue, so choose your settings accordingly. For example,
md.cluster=camhpc('numnodes',1,'cpuspernode',8);
md.cluster.time=10;
Cluster class camhpc.py still needs to be developed.
will request a maximum job time of 10 minutes and 8 cores on one node. If the run lasts longer than 10 minutes, it will be killed and you will not be able to retrieve your results.
If you want to check the status of your job and the queue that you are using, run,
squeue -u username
You can delete your job manually by typing,
qdel <JOB_ID>
where <JOB_ID> is the job ID reported on your local machine when you submitted your solution request. Also reported is the directory where you can find log files associated with the run (i.e. <JOB_ID>.outlog and <JOB_ID>.errlog). The outlog contains the information that would normally be printed to the console if you were running the job on your local machine. Likewise, the errlog contains any information printed in case of error.
If you would like to load results from the cluster manually (for example, if you encountered an error due to network disconnection), run,
md=loadresultsfromcluster(md,'runtimename','<EXEC_DIR>');
where <EXEC_DIR> is the parent of the job on your local machine, for example,
${ISSM_DIR}/execution/<EXEC_DIR>/<JOB_ID>.lock