====== Using RStudio ====== These directions are geared towards setting up and running RStudio on DARWIN. However, these directions can easily be used on Caviness, although references to software versions, partition names and compute node names may be different. ==== Start RStudio Server in Singularity Container ==== Do not run RStudio on the login (head) nodes. Always start an interactive job on a compute node before launching RStudio. First, make sure you are in your workgroup, then launch an interactive job on a compute node. For example using workgroup ''it_css'', account ''traine'' and specifying the ''standard'' partition, 2GB of memory and 1 hour of time, it would look something like this [traine@login00.darwin ~]$ workgroup -g it_css [(it_css:traine)@login00.darwin ~]$ SLURM_EXPORT_ENV=NONE salloc --mem=2G --time=1:00:00 --partition=standard salloc: Pending job allocation 5406889 salloc: job 5406889 queued and waiting for resources salloc: job 5406889 has been allocated resources salloc: Granted job allocation 5406889 salloc: Waiting for resource configuration salloc: Nodes r1n17 are ready for job [(it_css:traine)@r1n17 ~] Once on a compute node the prompt changes accordingly, in this case the compute node name is ''r1n17''. Now use VALET to load the RStudio package and the necessary software dependencies. [(it_css:traine)@r1n17 ~]$ vpkg_require r-studio-server/4.2.1 Adding dependency `squashfs-tools/4.5.1` to your environment Adding dependency `singularity/3.11.1` to your environment Adding package `r-studio-server/4.2.1` to your environment Once the RStudio software is loaded, then start the ''rserver'' within the Singularity container. This will initialize RStudio, allowing you to access it remotely through a web interface. It will look something like this [(it_css:traine)@r1n17 ~]$ Sexec rserver --server-user=$USER TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to '/var/log/rstudio/rstudio-server/rserver.log'. TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to '/var/log/rstudio/rstudio-server/rsession-traine.log'. Make a note of the compute node name, in this example ''r1n17'', as it will be needed for when establishing the SSH tunnel. ==== Establish SSH Tunnel ==== You must keep the SSH tunnel (terminal) open while using RStudio. === Linux/MacOS === If you are using Linux or MacOS, open the terminal on your laptop or desktop computer, and type ssh -L 8787:r1n17:8787 traine@darwin.hpc.udel.edu be sure to replace ''traine'' with your actual username, and substitute ''r1n17'' with the compute node name where your interactive job is running and where you started ''rserver'' in the previous step. You will need to log in using your DARWIN credentials in this terminal. If you are doing this on Caviness, then you would use the same command but replace ''darwin.hpc.udel.edu'' with ''caviness.hpc.udel.edu''. === Windows === If you are using a Windows machine, open PuTTY and enter the appropriate hostname {{:software:rstudio-putty-1.png?400|}} If you are doing this on Caviness, then you would use ''caviness.hpc.udel.edu'' instead of ''darwin.hpc.udel.edu''. In addition to your standard connection settings, you'll need to set up an SSH tunnel. To do this, navigate to **Connection → SSH → Tunnels** in PuTTY. Then, add the **Source Port** to ''8787'' and the **Destination** to ''r1n17:8787'' (remember to replace ''r1n17'' with the compute node name where your interactive job is running and where you started ''rserver'' in the previous step). {{:software:rstudio-putty-2.png?400|}} Click **Add** to confirm the tunnel settings, then click **Open** to connect. You will be prompted to enter your username and password for your DARWIN (or Caviness) account depending on which hostname you used in the previous step. {{:software:rstudio-putty-3.png?400|}} ==== Access RStudio Interface ==== Once SSH tunnel connection is established, then open a web browser on your laptop or desktop computer and navigate to the following URL localhost:8787 You should see the RStudio session start. Once you have completed your work, exit the RStudio session by closing the browser, close the SSH tunnel terminal, stop the ''rserver'' on the compute node with ''CTRL-C'', and then type ''exit'' to end the interactive job.