RStudio/Jupyter Lab on Cluster

Using RStudio/Jupyter Lab on the Cluster

To use RStudio or Jupyter Lab on the cluster, first navigate to the PennSIVE Bash Startup Scripts tab and make sure you have those aliases and startup commands in your bash startup files. Then, make sure you have sourced those startup files (See the Source new startup scripts on the PennSIVE Bash Startup Scripts tab.)

Add relevant aliases to your local computer

To make it easier to use RStudio/Jupyter Lab on the cluster, add the following aliases to your local bash. One easy way to do this is to edit the first four lines of the following code block (See the .env header on the PennSIVE Bash Startup Scripts tab) and then copy-paste the following code block at the bottom of the .bash_profile file on your personal computer. Make sure the PREFERRED_PORT you use here is identical to the one you used on the cluster.

CBICA_USERNAME="your_cbica_username"
PMACS_USERNAME="your_pmacs_username"
PREFERRED_PORT="your_preferred_port"
PREFERRED_PORT2=$(($PREFERRED_PORT + 1))

alias sciget="ssh ${PMACS_USERNAME}@sciget.pmacs.upenn.edu"
alias scisub="ssh ${PMACS_USERNAME}@scisub.pmacs.upenn.edu"
alias takim="ssh ${PMACS_USERNAME}@takim"
alias takimx="ssh -Y ${PMACS_USERNAME}@takim"
alias takimhttp="ssh -L ${PREFERRED_PORT}:127.0.0.1:${PREFERRED_PORT} -q ${PMACS_USERNAME}@takim"
alias takimhttp2="ssh -L ${PREFERRED_PORT2}:127.0.0.1:${PREFERRED_PORT2} -q ${PMACS_USERNAME}@takim"

Once the code is copied into your .bash_profile, load the edits with the following command (source ~/.bash_profile)

Now, once you connect to the PMACS VPN, you can easily ssh into the takim server by simply typing and entering the alias takim.

Using RStudio

To use RStudio on the cluster, follow the below steps:

  1. Connect to PMACS VPN
  2. Enter takim with ssh tunneling (takimhttp)
  3. Start RStudio singularity container (rstudio)
  4. Go to your favorite web browser (ie Chrome, Firefox, etc) and navigate to the following URL (localhost:your_preferred_port).
  1. For example, if my preferred port is 1520, I would navigate to (localhost:1520).
  2. If you have forgotten your preferred port, you can find it with this command (echo $PREFERRED_PORT)
  1. This should open RStudio in your browser, and you can use it like you normally do.
  1. One caveat is that, due to how this RStudio is set up, you are unable to access files outside of your home folder (~/), so if you need files from the /project folder, you may need to copy them into your home folder.

Note: Please do not run large jobs in browser RStudio. Anything you run here runs on the login node (takim), which is not designed to have large computing power. If you run something too big, it will crash the takim login server, and nobody else will be able to use the cluster until it is restarted by PMACS!

Using Jupyter Lab

To use Jupyter Lab on the cluster, follow the below steps:

  1. Connect to PMACS VPN
  2. Enter takim with ssh tunneling (takimhttp2)
  1. Note that the difference between takimhttp and takimhttp2 is just that the port numbers are different so the aliases work better. Additionally, having two different ports means that you are able to run RStudio and Jupyter Lab at the same time, if that is necessary for whatever reason.
  1. Start Jupyter Lab (jlab)
  1. If command does not work, you will have to install Jupyter Lab (https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html)
  1. Go to your favorite web browser (ie Chrome, Firefox, etc) and navigate to the following URL (localhost:your_preferred_port2).
  1. For example, if my preferred port is 1520, I would navigate to localhost:1521, which is my preferred port + 1.
  2. If you have forgotten your preferred port2, you can find it with this command (echo $PREFERRED_PORT2)
  1. This should open Jupyter Lab in your browser, and you can use it like you normally do.

Note: Please do not run large jobs in browser Jupyter Lab. Anything you run here runs on the login node (takim), which is not designed to have large computing power. If you run something too big, it will crash the takim login server, and nobody else will be able to use the cluster until it is restarted by PMACS!