R is available on Wynton HPC via a contributed environment module. It can be run interactively in the terminal via R
on a development node, as explain on the how-to ‘Work with R’ page. To run R via the RStudio IDE, there are two options:
The RStudio Server via the web browser (recommended)
The RStudio Desktop over X11 Forwarding
Running desktop applications over X11 forwarding works, but depending on your network connection, you will experience more or less lag. For instance, you might see a small delay between a key is pressed and it is echoed at the R prompt. Similarly, plotted graphics might take some time to render. This is also true for the RStudio Desktop. Because of this, we recommend running a personal RStudio Server instance, because that is designed to run remotely.
Regardless which one you use, you will be running the same version of R as you would when running from the terminal and all your installed packages will be available in either.
You can run a personal RStudio Server instance, which you, and only you, can access via your local web browser. Contrary to RStudio Desktop, this approach does not require X11 forwarding. Instead, it does require running two separate SSH connections to the cluster: (i) one to launch RStudio Server, and (ii) one to connect to it.
Assuming you are already logged on to a development node, launch your personal RStudio Server instance as:
[alice@dev1 ~]$ module load CBI rstudio-server-controller
[alice@dev1 ~]$ rsc start
alice, your personal RStudio Server 2023.09.1-494 running R 4.3.2 is available on:
<http://127.0.0.1:20612>
Importantly, if you are running from a remote machine without direct access
to dev1, you need to set up SSH port forwarding first, which you can do by
running:
ssh -L 20612:dev1:20612 alice@log1.wynton.ucsf.edu
in a second terminal from your local computer.
Any R session started times out after being idle for 120 minutes.
WARNING: You now have 10 minutes, until 2023-11-15 17:06:50-08:00, to
connect and log in to the RStudio Server before everything times out.
Your one-time random password for RStudio Server is: y+IWo7rfl7Z7MRCPI3Z4
There are two things you should pay extra attention to here:
The one-time random password that was generated
The instructions how to log in to the cluster with SSH port forwarding
You will need both below.
On your local computer, log into the cluster in a second terminal
following the instruction above. Make sure to use your own username
and make sure to use the port number (e.g. 20612
) that
was assigned to you.
{local}$ ssh -L 20612:dev1:20612 alice@log1.wynton.ucsf.edu
alice1@log1.wynton.ucsf.edu:s password: XXXXXXXXXXXXXXXXXXX
[alice@log1 ~]$
If you successfully completed the above two steps, and you made sure to use the correct port, then you should be able to open your personal RStudio Server in your local web browser by going to:
You will be presented with a ‘Sign in to RStudio’ web page where you need to enter:
alice
)y+IWo7rfl7Z7MRCPI3Z4
)After clicking ‘Sign In’, you should be redirected to the RStudio interface.
To terminate the RStudio Server, start by exiting R by typing quit()
at the R prompt. Then press Ctrl-C in the terminal where you called rsc start
. Alternatively, run rsc stop
in another terminal, e.g. the second one used in Step 2.
It is not possible to run RStudio Desktop via X2Go, because X2Go does not support the modern graphical protocols that RStudio Desktop requires.
To run the RStudio Desktop client, you must be logged via SSH with X11 forwarding enabled. Then load the rstudio
(Desktop) module from the CBI stack and launch rstudio
:
[alice@dev1 ~]$ module load CBI rstudio
[alice@dev1 ~]$ rstudio
TTY detected. Printing informational message about logging configuration.
Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to
'/wynton/home/boblab/alice/.local/share/rstudio/log/rdesktop.log'.
You should see the RStudio Desktop interface appear after a few seconds. If you get a blank window, which some macOS users have reported, retry with:
[alice@dev1 ~]$ QMLSCENE_DEVICE=softwarecontext rstudio
To exit the RStudio Desktop, type quit()
at the R prompt, or press Ctrl-C in the above terminal.