Using RStudio Server or RStudio Desktop on a Quest compute node

RStudio Server is offered to all Quest users on the Analytics Nodes and is a convenient, browser-based option for R users. Because the Analytics Nodes are a shared resource, you are limited in what kind of workflows are appropriate to run on this resource. Moreover, your experience using RStudio Server may be slower or unstable due to the activity of other users. Especially, if you are working with large datasets, you may find yourself crashing your RStudio session on the Analytics Nodes.

To that end, users can run RStudio Server (preferred) or RStudio Desktop on the Quest compute nodes, where you can reserve memory and CPU resources and do not have to share resources with other users.

RStudio Server

RStudio Server can be launched and run on a Quest compute node through an interactive job or batch job on Quest.

To schedule the interactive job from the command line on Quest, ssh into a login node and type:

srun -A <allocation_name> -p <queue_name> -N 1 --ntasks-per-node=1 --mem-per-cpu=4G --time=04:00:00 --pty bash -l

This example requests a single core for a 4 hour job. Substitute an active allocation name and queue name, for example if using allocation p12345 this might be:

srun -A p12345 -p short -N 1 --ntasks-per-node=1 --mem-per-cpu=4G --time=04:00:00 --pty bash -l

Note that the more cores requested, the longer the wait for the interactive session to start. Do not request more than 1 node for RStudio Server sessions.

Once the session begins, get the name of the compute node the session has landed on by running the command hostname, e.g.,

$ hostname
qnode0372

Next, load the version of R you would like to run and any additional modules that you need for installing or using certain R packages, e.g.,

[qnode0372 ~]$ module purge
[qnode0372 ~]$ module load R/4.2.0
[qnode0372 ~]$ module load geos/3.8.1

After you have loaded these modules, load the rstudio-server/2023.06 module, which will display to you a short hand version of the instructions that you see here.

[qnode0372 ~]$ module load rstudio-server/2023.06
If you have not already done so, make sure you are running and interactive or batch
job.
Before launching RStudio Server, load the version of R you would like to run and any
additional modules that you need for installing or using certain R packages, e.g.,
module load R/4.2.0
module load geos/3.8.1
Once this is done, call the command `rserver <port_number>` where <port_number>
should be a value between 8000 and 9000.
Based on the port number and the compute node that RStudio Server is running on, you
will then tunnel to the server using the command:
`ssh -L <port_number>:localhost:<port_number> <your_netID>@quest.northwestern.edu ssh
-N -L <port_number>:localhost:<port_number> qnode<number>` filling in the appropriate
value for <port_number> and <compute_node>
Finally, in your *local browser* you can then put in the URL
`localhost:<port_number>` and connect to your RStudio Server session. 

Once RStudio Server is running on the compute node, open a new terminal window on your local computer, and type:

ssh -L <port_number>:localhost:<port_number> <your_netID>@quest.northwestern.edu ssh -g -N -L <port_number>:localhost:<port_number> qnode<number>

In the command template above, be sure to replace <your_netID> with your netID, replace qnode<number> with the name of the compute node, and replace all <port_number> instances with the port number between 8000 and 9000 that you selected. You will be prompted for your Quest password, which will not return a prompt.

On your local computer, open up your browser and connect to http://localhost:<port_number>/. Your browser is now connected to the RStudio Server session running on Quest.

Note that your RStudio Server session will quit abruptly when the walltime of the interactive job comes to an end. Save often and be aware of walltime to avoid losing your work.

RStudio Desktop

You can also use RStudio Desktop on a compute node. To do so, open a FastX3 GNOME Desktop or Terminal and run the following code to request an interactive job with GUI support:

[<netid>@quser34 ~]$ salloc -A a9009 -p a9009 -t 04:00:00 --mem=16GB
salloc: Pending job allocation 3630149
salloc: job 3630149 queued and waiting for resources
salloc: job 3630149 has been allocated resources
salloc: Granted job allocation 3630149
salloc: Waiting for resource configuration
salloc: Nodes qnode0372 are ready for job
[<netid>@quser34 ~]$ ssh -X qnode0372
[<netid>@qnode0372 ~]$ module load R/4.1.1
[<netid>@qnode0372 ~]$ rstudio

The above interactive job supports X-forwarding when you SSH to the compute node with the -X argument, which is crucial for enabling GUIs such as RStudio to launch and display properly. After connecting to the assigned compute node, we load the R/4.1.1 module (the same version present on the Analytics Nodes at the time of writing) and launch RStudio in a new window with the rstudio command. If you load the same R module that is present on the Analytics Nodes, any R packages you installed in your use of the RStudio Server will also be available to you on a compute node, assuming you did not alter the default installation path.

By following these simple instructions, you now have access to 16GB of memory for 4 hours to run RStudio on a compute node. To exit RStudio, press Ctrl+C in the FastX3 terminal.

Was this helpful?
0 reviews

Details

Article ID: 2175
Created
Tue 2/21/23 3:37 PM
Modified
Fri 1/5/24 10:18 AM

Related Articles (1)

Learn how your can run VS Code (Server) on a Quest Compute Node