RStudio Server on HPC

Run RStudio Server as a Singularity container on a compute node

Usage

Submit the RStudio Server job and follow the prompts to connect. To do so, download the script to your home directory:

curl -O https://wanggroup.org/scripts/rstudio_cumc_cloud.sh

Then modify the script as needed:

  • Adjust memory and wall time requirements: Default to 15GB memory running 18 hours which typically works for moderate scale of computing.
  • Add bash configurations before the RStudio launch command (e.g., custom paths from your ~/.bashrc or simply add source ~/.bashrc).
  • Add module load Singularity/4.2.1 after the last #SBATCH to load the singularity software.

And then submit the job. Choose the option that matches your setup:

With your own R installation (preferred approach for Gao Wang’s lab):

bash rstudio_cumc_cloud.sh -s /path/to/rstudio-no-r.sif -r ~/.pixi/envs/r-base/bin -i <hpc_ip>

You can also omit -r if R is in your PATH — in that case the script auto-detects R.

With container’s bundled R (e.g., rocker-based containers):

bash rstudio_cumc_cloud.sh -s /path/to/rstudio-server.sif -i <hpc_ip>

Note: Run the script with bash (not sbatch) to validate inputs on the head node before job submission. This gives immediate feedback if the SIF file is missing, R cannot be found, or there’s an OpenSSL mismatch.

Please refer to CU_Neurology_HPC_Info_2026.md (requires CUMC VPN or on-campus connection) for path to this SIF file on our HPC.

Connect

After the job starts, check the job output file for connection info:

cat rstudio_<JOBID>.out

Replace <JOBID> with your actual job ID. You’ll see instruction like:

========================================
RStudio Server - Job 12345678
========================================
On your LOCAL machine, run:
   ssh -N -L 9986:ondemand-dy-cpu2mem16a-2:9986 username@hpc_ip

Then open: http://127.0.0.1:9986
To stop:   scancel 12345678
========================================

Session cache: /home/username/rstudio-status/share
For a fresh start, remove cache: rm -rf /home/username/rstudio-status/share

Replace <JOBID> with your actual job ID, then open http://127.0.0.1:9986.

OpenSSL Mismatch

The script checks OpenSSL compatibility between your R and the container. If mismatched, it errors out with instructions. If you see an OpenSSL mismatch error, rebuild the no-R container with a matching RStudio version:

Your R’s OpenSSL Use RSTUDIO_VERSION
3.x 2026.01.0-392
1.x 2023.12.1-402

To do so, edit rstudio.def, change RSTUDIO_VERSION, then:

singularity build --fakeroot rstudio-no-r.sif rstudio.def

If you cannot run --fakeroot under your HPC account you can do this on a local desktop or laptop and upload the resulting sif file to HPC; or ask our IT admin to do this for you.

(Of course you could rebuild your R environment to match the container, but most likely you don’t want to.)

Notes

  • Cost: Terminate when done: scancel <JOBID>