In [1]:
## here is what mine looks like
cat ~/.ssh/config
In [ ]:
## connect to the cluster with ssh
ssh oldenburg
In [ ]:
### Check the queue on the Cluster
squeue -u adta5102
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
2635677 carl.p test adta5102 R 56:54 1 mpcl009
2635709 carl.p bash adta5102 R 29:02 1 mpcl009
In [ ]:
>>> srun -p carl.p -t 1:00:00 -N 1 -n 4 --pty /bin/bash
In [ ]:
## shows all available software
module avail
## load a module
module load OpenMPI/2.0.1-GCC-6.2.0
Alternatively, you can install software locally, in which case, I recommend using conda. This is the default mode by which ipyrad
should be installed, and is useful for other software which you want to update frequently.
In [ ]:
## download and install conda for linux
curl -O https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash -b Miniconda2-latest-Linux-x86_64.sh
## source the installation (puts it in your $PATH)
source ~/.bashrc
In [2]:
## test that conda is installed.
conda info
In [ ]:
## install some recipes from the bioconda channel
conda install raxml -c bioconda
## install some recipes from the ipyrad channel
conda install bpp -c bioconda
In [ ]:
#!/bin/bash
#SBATCH --partition carl.p
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 24
#SBATCH --exclusive
#SBATCH --time 4:00:00
#SBATCH --mem-per-cpu 4000
#SBATCH --job-name test
#SBATCH --output test-conda-%J.txt
## show the location of my software
which conda
which raxml
which bpp
In [ ]:
#!/bin/bash
#SBATCH --partition carl.p
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 24
#SBATCH --exclusive
#SBATCH --time 4:00:00
#SBATCH --mem-per-cpu 4000
#SBATCH --job-name test
#SBATCH --output test-conda-%J.txt
## re-source the $PATH
source /user/adta5102/.bashrc
## show the location of my software
which conda
which raxml
which bpp
A powerful way to work on an HPC cluster is through Jupyter notebooks, which allow you to work interactively while also keeping a detailed record of your work. Submit this script below and follow the instructions to launch an SSH tunnel to connect to a remote jupyter server from your laptop.
In [ ]:
#!/bin/bash
#SBATCH --partition carl.p
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 24
#SBATCH --exclusive
#SBATCH --time 24:00:00
#SBATCH --mem-per-cpu 4000
#SBATCH --job-name tunnel
#SBATCH --output jupyter-log-%J.txt
## get tunneling info
XDG_RUNTIME_DIR=""
ipnport=$(shuf -i8000-9999 -n1)
ipnip=$(hostname -i)
## print tunneling instructions to jupyter-log-{jobid}.txt
echo -e "
Paste this ssh command in a terminal on local host (i.e., laptop)
-----------------------------------------------------------------
ssh -N -L $ipnport:$ipnip:$ipnport {user@host}
Open this address in a browser on local host; see token below.
-----------------------------------------------------------------
localhost:$ipnport (prepend with https:// if using a password)
"
## launch a jupyter server on the specified port & ip
jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip
Once the job starts check the log file which it produces named jupyter-log-{xxx}.txt
. It should look something like the output below. On your local computer (i.e., laptop) open a terminal and paste in the ssh tunneling command. Replace {user@host} with your credentials.
In [ ]:
## submit the job
sbatch slurm_jupyter.sbatch
In [ ]:
## check the lob
cat jupyter-log-2637903.txt
Paste this ssh command in a terminal on local host (i.e., laptop)
-----------------------------------------------------------------
ssh -N -L 8506:10.151.9.5:8506 {user@host}
Open this address in a browser on local host; see token below.
-----------------------------------------------------------------
localhost:8506 (prepend with https:// if using a password)
[I 20:14:58.579 NotebookApp] Serving notebooks from local directory: /user/adta5102
[I 20:14:58.580 NotebookApp] 0 active kernels
[I 20:14:58.580 NotebookApp] The Jupyter Notebook is running at: http://10.151.9.5:8506/?token=039fbda2b6139c8ba4e213e4af1e77662b8091d6714846e1
[I 20:14:58.580 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:14:58.589 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://10.151.9.5:8506/?token=039fbda2b6139c8ba4e213e4af1e77662b8091d6714846e1