Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Extend RStudio documentation #2385

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
61 changes: 54 additions & 7 deletions docs/computing/webinterface/rstudio.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,56 @@
The RStudio application will launch a RStudio session on Puhti
with the specified resources using the selected
[r-env](../../apps/r-env.md) version.
# RStudio

Selecting Multithreaded will set `OMP_NUM_THREADS`
to the number of requested CPU cores.
The RStudio application will launch an RStudio session on Puhti with the specified resources using
the selected [R environment (r-env) version](../../apps/r-env.md#available)). Currently, the latest available r-env
(and R) version is **4.4.0**.

The user is automatically logged in to the rstudio session
when pressing the **Connect to RStudio Server** button.
The user is automatically logged in to the RStudio session when pressing the **Connect to RStudio
Server** button.

Selecting **Multithreaded** will set the environment variable `OMP_NUM_THREADS`, controlling the number
of OpenMP threads, to the number of requested CPU cores. See [r-env documentation on
threading](../../apps/r-env.md#improving-performance-using-threading) for more details.

!!! note "When to use RStudio?"
RStudio sessions on Puhti are meant for interactive work, for example R script development and running light and medium-heavy analyses up to a few hours. Long,
memory-intensive, or otherwise resource-heavy tasks are best carried out as [non-interactive batch jobs](../../apps/r-env.md#non-interactive-use).

## Frequently asked questions about RStudio

### RStudio is not starting and I see a grey screen. What should I do?

If an RStudio session fails to start or RStudio is extremely slow, first try resetting your
RStudio user state as described below. These steps will clean up leftover data from previous interrupted RStudio
sessions in two hidden folders in the user's home directory: `.config/rstudio` and `.local/share/rstudio`. These folders can be either renamed (to keep the contents) or deleted (if you are sure the contents are not needed).

**Option 1:** Use the file viewer in the Puhti web interface:

1. In the top left corner of the Puhti web interface dashboard, choose **Files** and **Home Directory**.
2. Click **Show dotfiles**.
3. Delete or rename the `rstudio` folders under `.config` and `.local` -> `share`.

**Option 2:** Use a terminal (for example a login node shell in the Puhti web interface) to delete or rename these folders. Here is an example how renaming would work:

`mv ~/.config/rstudio ~/.config/rstudio-old`
`mv ~/.local/share/rstudio ~/.local/share/rstudio-old`

If after this RStudio still fails to start or remains very slow, please [contact CSC Service
Desk](../../support/contact.md).

### How do I install an R package?

The R environment on Puhti has over 1400 pre-installed R packages packages ready to use. The easiest
way to check if a package is available is to try to load it with `library(packagename)`. If a
package is missing, you can install it yourself for your project by following the [instructions for R package
installation](../../apps/r-env.md#r-package-installations), or you can [contact CSC Service
Desk](../../support/contact.md) for a general installation available to all users.

### How do I change the directory shown in the RStudio files panel?

By default, the files panel shows your home directory on Puhti. To change the directory, click the three dots on the top right of the panel. In the box that appears, type the target directory, for example `/scratch/<project>`.

## More information

For more information on the R environment on Puhti, see the [r-env
documentation](../../apps/r-env.md). If you have a question, please [contact CSC Service
Desk](../../support/contact.md).