Skip to content

Posit Workbench

Posit Workbench provides access to RStudio, JupyterLab, and Jupyter Notebook from a web browser. The R and Python code you work on in these environments runs on the high performance CPUs and GPUs in the CMRI HPC Cluster.


Accessing Posit Workbench

  1. Open a web browser and navigate to cmri-vm-rstudio.cmh.internal.
  2. Enter your CMH account username and password when prompted.

If you used the previous RStudio instance at CMRI, please read the RStudio FAQ at the bottom of the page for information on the differences between this instance and that one.

Configuring a Session

After logging in, you will be redirected to the landing page where you have the option to start a new session. Sessions are instances of RStudio, JupyterLab, or Jupyter Notebook that run on the CMRI HPC Cluster. To start a new session, click the "New Session" button. This will open a menu where you can configure the session. The first three fields you can change are the "Session Type", "Session Name", and "Cluster":

Posit Workbench session setup with Jupyter Notebook, JupyterLab, and RStudio Pro choices, plus session name and cluster fields

  • Session Type
  • The three buttons at the top of the menu are the editors you can choose from: Jupyter Notebook, JupyterLab, and RStudio Pro. Select the editor you would like to use.
  • Session Name
  • This is used to help identify the session. You should change the name to something that describes what you plan on working on in the session.
  • Cluster
  • This defines the cluster your job will run on. There is only one choice for this option, "Slurm", which is the name of the scheduling software the CMRI HPC Cluster uses.

After setting a session name and selecting an editor, there are four configuration options you can customize. These options control how many resources are allocated to your session. Please be considerate of others and only request resources that you will use to run your R or Python code.

Posit Workbench resource settings for CPUs, memory, GPUs, and queue, including their current values and limits

Each option is explained below:

  1. CPUs
    • This is the number of CPU cores you would like to have available in your session. The default is eight and the maximum is 112.
  2. Memory
    • This is the amount of memory in megabytes you would like to have available in your session. The default is ~54G, and the maximum is ~754G.
  3. GPUs
    • This is the number of GPUs you would like to have available in your session. GPUs can only be requested if the 'gpu' queue is selected. The default number of GPUs is zero and the maximum is one.
  4. Queue
    • This is the queue you would like your session to run in. Queues determine the maximum amount of time your session will run, as well as whether or not GPUs are available. See the table below for differences between the available queues.

Note

Remember, per the ARC team's policies and etiquette outlined on the User Policies page, please be a good neighbor and only request the resources you need.

Name Default Time Limit GPUs
short Yes 8 hours No
medium No 2 days No
long No 2 weeks No
gpu No 1 week Yes
test No 2 days Yes

See the Jobs and Partitions section on the HPC Cluster page for more information on queues.

Starting a Session

After configuring your new session, click the "Start Session" button at the botton of the menu. Your session will begin as soon as resources are available. For information on each of the editors (RStudio, JupyterLab, Jupyter Notebook), see the documentation sites linked below:

Installing Packages

While using RStudio you will likely want to install additional R or Python packages. The sections below give step-by-step instructions on how to install and use additional packages in each editor.

RStudio

Additional R packages can be installed directly from the "Console" tab in RStudio using the install.packages() function:

RStudio console installing the yaml package with install.packages

Packages installed using this method are added to your personal "R" directory (~/R). If all of your projects use the same set of packages and package versions, this is the simplest way to install and manage them.

If you have more complex dependencies, such as multiple projects that use different versions of the same package, we recommend using packrat instead. packrat is an R package that allows you to install and manage packages in self contained libraries for each project. The steps below walk through how to install packages in a new project using packrat:

  1. Create a project directory by clicking on the "New Folder" button under the "Files" tab on the right side near the middle of the screen:
    RStudio Files pane with the New Folder control
  2. Click on the directory you just created in the "Files" tab, then select "More > Set As Working Directory".
  3. In the "Console" tab, run packrat::init(). This will initialize packrat in your project directory:
    RStudio console initializing packrat in the project directory
  4. After initializing packrat, you can use install.packages() to install packages in the project directory: RStudio console installing a package in the project's packrat library

For additional information on managing R packages with packrat, see the official Packrat Documentation.

Jupyter

Installing additional packages for JupyterLab and Jupyter Notebook requires you to create a virtual environment. Follow the steps below to create a virtual environment and install packages from an active JupyterLab or Jupyter Notebook session:

  1. From your session, open a terminal.

    • For JupyterLab, click on the terminal icon on the session landing page. For Jupyter Notebook, click on the "New" button in the top right corner and select "Terminal" from the dropdown menu.
  2. Run module load miniconda3 in the terminal to load the Miniconda 3 module.

    • See the Software section on the HPC Cluster page for more information on software modules.
  3. Create a conda environment by running:

    conda create -n <env_name> python=<python_version>
    
    • If you are using an existing environment, skip this step.
    • Replace <env_name> and <python_version> with a name for the environment and the Python version you want to use, respectively.
  4. Activate the conda environment by running:

    conda activate <env_name>
    
  5. Install the packages you would like to use with the conda install command.

  6. Install the ipykernel package by running these commands:

    conda install ipykernel
    python -m ipykernel install --user --name <env_name> --display-name "<display_name>"
    
    • Replace <env_name> and <display_name> with the name of the environment you are using and the display name you want to identify the environment with, respectively.

You can now select the environment you created when starting a notebook, giving you access to the modules installed in it from a Jupyter session. Existing notebooks typically need to be restarted for the new kernel to appear as an option.

RStudio FAQ

This section contains frequently asked questions and answers about RStudio.

Q: How does this RStudio instance differ from the previous CMRI RStudio instance?

A: There are several key differences between the instances:

  1. Sessions do not run on the local system. They run on nodes in an HPC cluster instead, providing more resources and letting you reserve them exclusively for your session.
  2. Sessions may take more time to start. They wait until resources are available in the cluster.
  3. Sessions have time limits. RStudio and Jupyter sessions stop after they reach the time limit for their queue. See Configuring a Session above for more information.