To launch RStudio on GRACE you need to create a submission script. You can use the following template below:
Code Block | ||
---|---|---|
| ||
#!/bin/bash
#SBATCH --job-name=RStudio_Server
#SBATCH --nodes=1
#SBATCH --time=10:00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --partition=any
#SBATCH --mem=10GB
#SBATCH --output=/home/%u/rstudio-server.job.%j
readonly PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
cat 1>&2 <<END
1. SSH tunnel from your workstation using the following command:
ssh -N -L 8787:${HOSTNAME}:${PORT} ${USER}@144.30.235.160
and point your web browser to http://localhost:8787
2. log in to RStudio Server using the following credentials:
user: ${USER}
password: ${PASSWORD}
When done using RStudio Server, terminate the job by:
1. Exit the RStudio Session ("power" button in the top right corner of the RStudio window)
2. Issue the following command on the login node:
scancel -f ${SLURM_JOB_ID}
END
module use --append /home/$USER/modulefiles
module load singularity/x.y.z
module load rstudio_singularity
rserver --www-port ${PORT} |
first login to the HPC portal at: portal.hpc.uams.edu
...
Then navigate to the Interactive Apps tab in the top and select RStudio Server
This will bring up a submission form where you will specify time, memory, CPUs needed for your job.
You can also specify which type of nodes you want to queue on using the Queue drop down menu.
Warning |
---|
By default the RStudio server will use the base conda environment for the R library and R version. If you need other packages or a different R version you should create a conda environment containing all the packages and appropriate R version on the login node. You then would give the full conda environment path (i.e. /home/username/.conda/envs/my_env) in the "conda env fullpath" box to specify the location of the conda environment to get your desired R packages and version. |
Click Launch to submit the RStudio Server as a job.
...
Once the job is submitted your RStudio Server session will be Queued
...
Once the RStudio Server session has found an available node the status will switch to Starting. The RStudio Server session will not be available yet as it is still starting up.
...
Once your RStudio Server session is ready the status will change to Running and you must click on the "(R) Connect to RStudio Server" button to access RStudio
...
Once you click the Connect button you should see RStudio displayed in your browser.
Warning |
---|
Note: As the RStudio session is running on a compute node (which doesn't have internet access), you will be unable to install packages from within the RStudio Session. You must leave the session and update your conda environment and resubmit the RStudio job to add packages that you have forgotten. |
...
Warning |
---|
NOTE: If you switch R versions by changing conda environments you will see a message like this in the new session. |
Warning |
---|
While the version of R has changed you may feel more comfortable restarting R as shown below |
When you submit the job you will need to find the output file that contains the instructions to create the ssh tunnel to connect to RStudio. A VPN connection is required to open SSH tunnels. To open the SSH tunnel simply open a terminal on your local machine and copy the ssh command in the output file and then type "http://localhost:8787" in your browser window once the tunnel connects.