Tips and tricks for using RstudioServer on Hulk - Hansen-Group/HansenWiki GitHub Wiki

This document was written by Malte Thodberg and last updated 2022-06-08.

Official cluster wiki: https://sites.google.com/site/cmbrgenetics/cluster

Access RStudioServer on Hulk

When using a physical ethernet connection at CBMR, you can access RStudioServer on Hulk by typing this address in a brower:

http://hulk:8787

When using VPN, you can use:

http://hulk.sund.root.ku.dk:8787/

If you still have trouble connecting over KU VPN, you can try ssh tunneling via porus. First execute this command in the terminal:

ssh -L 9000:hulk:8787 [email protected]

And then visit http://localhost:9000 for RStudioServer.

Edit ~/.R/Makevars to use a newer C++ version

Hulk is very old, so you might not be able to install R-packages that depends on newer C++ compilers. Instead you can edit your ~/.R/Makevars file to point to a local and newer version of C++:

CC=/opt/rh/devtoolset-11/root/usr/bin/gcc

CXX=/opt/rh/devtoolset-11/root/usr/bin/g++

CXX11=/opt/rh/devtoolset-11/root/usr/bin/g++

CXX14=/opt/rh/devtoolset-11/root/usr/bin/g++

Some packages will require additional flags set in the same file:

CXXFLAGS=-O3 -march=native -Wno-ignored-attributes

CXX11FLAGS=-O3 -march=native -Wno-ignored-attributes

CXX14FLAGS=-O3 -march=native -Wno-ignored-attributes

CXXPICFLAGS=-fPIC

CXX11PICFLAGS=-fPIC

CXX14PICFLAGS=-fPIC

You will need to restart RStudioServer server for these to take effect.

Edit ~/.Renviron to control library and tempoary locations

Installed R-packages will by default be placed in your personal home directory. If you do not want this, you can put your R-packages in local folder instead, by adding this line to your ~/.Renviron file:

R_LIBS_USER="/emc/cbmr/users/abc123/R/%v"

You will need to manually create this folder with mkdir first. The %v specifies the version of R (e.g. 4.1). This allows you keep different collections of R-packages in your local folder (useful is you sometimes work on porus which has a much older version of R currently.)

Sometimes other users might freeze RStudioServer (and the terminal) by filling up the default temporary storage on hulk. To avoid this, you can instruct R to save temporary files to your own personal directory:

TMPDIR="/emc/cbmr/users/abc123/tools/R/tmp"

You will need to manually create this folder with mkdir first.

Mount the server locally

The official cluster wiki contains a guide for how to mount hulk/porus locally via sshfs, so you can browse files via you your local file browser (e.g. Finder on macOS).

If you have a newer Apple Silicon Mac (M1), you need some additional actions to enable sshfs, described here:

https://techstuffer.com/fuse-for-macos-apple-silicon-m1/

Fixing error when producing plots

If you see an error when trying to produce plots along these lines: RStudio? Errors: Shadow graphics device error: r error 4 (R code execution error) & unable to open connection to X11 display, you can fix this by going Tools > Global options > General > Graphics and select "Cairo". After restarting RStudioServer you should be able to plot.