WhitakerLab / WhitakerLabProjectManagement

This repository contains issues related to the management of all Whitaker Lab projects
Creative Commons Attribution 4.0 International
32 stars 42 forks source link

Write up how to guide for HPHI #39

Open KirstieJane opened 7 years ago

KirstieJane commented 7 years ago

This could potentially be a protocols.io guide.

Apply for an account

  1. Apply for an HPHI account.

    wait for account to be created

Download and setup the required software

  1. Download X2Go client & Putty
  2. Set up a connection to the Cambridge VPN service Choose the operating system you use (eg Windows 10, OS X Sierra etc) from the links on the left side of that page to find the specific instructions for your device.

Connect

  1. Connect (either via X2Go, or Putty) to wbic-gate.vss.cloud.private.cam.ac.uk Check out the pictures at this help page to make sure you get all the right checkboxes filled in!
KirstieJane commented 7 years ago

Need to create python enviroment: https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

My command: conda create -n kwPython361 python=3.6.1 anaconda

But note that this doesn't work with BrainsForPublication 😭

So also need: conda create -n kwPython27 vtk mayavi python=2.7 anaconda

There's a whole bunch of conda magic that has to happen here by the way, the most important point being that you must install vtk and mayavi on the same line as you create the environment! Conda will then take care of all the dependencies (which are rather complicated wrt mayavi) and all will be well.

😕 Unfortunately this doesn't actually work - it does run, and it makes the brains but it doesn't save them (they're black squares!). I can run the commands from the root installation but not from my kwPython27 installation. I've sent an email to support to see if they have any ideas!

KirstieJane commented 7 years ago

If you want to use git you need to load the git version 2.13.2 module: module load git/2.13.2

This is in my bashrc file.

If you have 2 factor authentication turned on then you can't use your password to push to github. You need to use your personal access token: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

I've saved this in my home directory in a folder called API_TOKENS and a file called GitHub. Note that the default on the HPHI is to give read access to all members so you need to change this setting!! You can type chmod 700 API_TOKENS and then chmod 600 -R API_TOKENS/* from your home directory.

Finally, you can set github to remember your password in a cache for a certain amount of time so you don't have to enter your password every time: https://help.github.com/articles/caching-your-github-password-in-git/#platform-linux. I've set mine for 4 hours: git config --global credential.helper 'cache --timeout=14400'

I've set the git editor to nano with a line width of 72 to try to write better commit messages :smile:

git config --global core.editor "nano -r 72"

And I've also set up a gitmessage template from this gist by Richard Bronosky.

KirstieJane commented 7 years ago

Change the default settings for the prompt by adding the following to your .bashrc file. (Source: https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html)

# Hide a bunch of the directories in the terminal
# This guide prints out the user, host and 
# just the basename of the working directory
# (not the full path)
# eg: [kw401@wbic.gate SCRIPTS]$ 
export PS1='[\u@\h \W]$ '

# Source inputrc
export INPUTRC=~/.inputrc

The last line will source an .inputrc file that contains the following two lines so you 1) don't have to double tab to complete symbolic links and 2) can use CTRL + left or CTRL + right to skip through words.

 set mark-symlinked-directories on

 "\eOC": forward-word
 "\eOD": backward-word
  1. Taken from this guide: http://www.pedrodiaz.com/cs/linux/bashtips.php
  2. Taken from https://unix.stackexchange.com/questions/10806/how-to-change-previous-next-word-shortcut-in-bash
KirstieJane commented 7 years ago

Here's a great guide for SLURM http://www.cism.ucl.ac.be/Services/Formations/slurm/2016/slurm.pdf

I've written two commands: SlurmLoop.sh and LoopCommandOverSubjects_HPHI.sh. They're both in the /lustre/scratch/wbic-beta/kw401/SCRIPTS folder.

SlurmLoop.sh takes as an argument a directory that has a bunch of scripts inside it and submits those as a sbatch array.

LoopCommandOverSubject_HPHI.sh calls SlurmLoop.sh but first makes all those scripts in a LOOP_COMMANDS directory in your home folder. It requires a few quite NSPN specific inputs.

squeue

To see which jobs are running type squeue. If you only want to see your jobs then type squeue -u ${USER}

sacctmgr

To see what the submission limits are for the HPHI just type:

sacctmgr show qos

KirstieJane commented 7 years ago

From HPHI set up a ssh key so you can easily link to the HPC by following the instructions here: http://www.thegeekstuff.com/2011/07/rsync-over-ssh-without-password/

Islast commented 6 years ago

NIIICE!!! Kirstie this is so useful :star2::+1:

KirstieJane commented 6 years ago

Sorry for not sending it to you earlier!! 😬 Glad it's helpful though!

Islast commented 6 years ago

Note on module loading- if you're expecting software to be available and bash doesn't seem to recognise it, e.g screenshot from 2018-01-23 14-47-57

Try checking you have the module loaded. Packages may be installed onto the HPHI system but not loaded for your session. module list will tell you which modules you have loaded module avail will tell you which modules are installed to the system, and module load X will add X to the loaded modules

information on modules in the HPHI is here: https://www.wbic.cam.ac.uk/facilities/high-performance-hub-for-clinical-informatics/software-and-modules