Some applications on the HPC clusters have a GUI or graphical user interface. These include Firefox, xterm, eog, ncview, nvvp, DDT and many more. Below we discuss multiple methods for working with GUI applications.
To use this approach you must satisfy two conditions: (1) You must have an X server installed and running on your local machine (see X Server Software below) and (2) when connecting with ssh one must add the -X option to enable X11 forwarding.
For instance, to connect to Della from a Mac laptop where XQuartz is installed and running:
$ ssh -X <YourNetID>@della.princeton.edu
In some cases connecting with -X fails while using -Y works. The -Y option enables trusted X11 forwarding:
$ ssh -Y <YourNetID>@della.princeton.edu
If you are connecting from off-campus then additional steps are necessary.
X Server Software
You must have an X server running on your local machine (e.g., laptop) to work with GUIs on the clusters. Visit the OIT Tech Store if you need help with installing and configuring these programs.
Linux comes with a built-in X server. No action is necessary.
Mac users should install XQuartz. If you already have it installed then make sure that you have the latest version by opening XQuartz and choosing "XQuartz" in the menu then "Check for X11 Updates ...". And make sure it is running (by opening it) before trying to ssh.
Windows users should use MobaXterm (Home Edition). Another possibility is the combination of PuTTY and Xming.
If you fail to login following the procedure above or your configuration is incorrect then you will encounter errors like the following:
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11 Running without a11y support! Error: no DISPLAY environment variable specified
Error: Can't open display:
Gtk-WARNING **: 21:27:55.100: cannot open display:
Cannot load backend 'TkAgg'
Make Sure You Are Not Over Quota
One reason that X11 forwarding can fail is insufficient storage space in your /home directory on the cluster. Run the checkquota command to ensure that you are not over your quota. For Nobel see the "Trouble Connecting" section on the Stata page.
Xpra is an open-source multi-platform persistent remote display server and client for forwarding applications and desktop screens. After installing it on your local machine (e.g., laptop) then open a terminal (also on your local machine) and run the following command to start a session (replace aturing with your NetID):
$ xpra start ssh://firstname.lastname@example.org --start=xterm --opengl=no
This will launch an xterm on the remote machine (which is Della in the example above). You can then run GUI applications in the xterm. Xpra is similar to X11 forwarding (i.e., ssh -X) except that performance will be noticeably better and you can disconnect and re-connect to this session as many times as you like. Use the following command to reattach:
$ xpra attach ssh://email@example.com/ --opengl=no
See more use cases.
If you have an acount on Tiger, Della, Traverse or Perseus then consider installing TurboVNC which offers far better performance than X11 forwarding. In this case you connect to tigressdata.princeton.edu using TurboVNC and then ssh -X to the desired cluster from tigressdata. It will take you a few minutes to install and configure TurboVNC but you will find that the performance is excellent. Visit the OIT Tech Store for resolving issues with installing and configuring this software.
One can work with graphical applications on Adroit or Della using a virtual desktop. The virtual desktop is provided by a Singularity container so only the applications that are installed on the image or those in bind-mounted directories are available. If the application you want to use is not available then please submit a request to firstname.lastname@example.org.
Below is the procedure for launching a virtual desktop session:
- Point your browser to https://myadroit.princeton.edu or https://mydella.princeton.edu (VPN required)
- From the orange menu bar click on "Interactive Apps" and select "Desktop." You'll get a form for requesting a session. Set the required number of hours, cores and memory.
- Check the option to get email notification when the desktop has been created.
- Click Launch.
- Open Desktop.
- Once your virtual desktop has been created it will appear in MyAdroit/MyDella under "Interactive Apps>Desktops". Click on the blue "Launch Desktop" button to start your session.
Note that virtual desktop sessions run on the compute nodes which cannot access the internet so you will not be able to download files or access webpages during the session.
In order to see figures when calling plt.show() you will need to connect using ssh -X or ssh -Y, for example:
$ ssh -X <YourNetID>@della.princeton.edu $ module load anaconda3/2020.11 $ python >>> import matplotlib.pyplot as plt >>> plt.plot(range(2)) >>> plt.show()
If you only want to save your figures as images (and not view them) then use a non-interactive backend. The -X option is not needed in this case:
$ ssh <YourNetID>@della.princeton.edu $ module load anaconda3/2020.11 $ python >>> import matplotlib >>> matplotlib.use('Agg') >>> import matplotlib.pyplot as plt >>> plt.plot(range(2)) >>> plt.savefig("myplot.png")
Read more about the backends of Matplotlib. Using a non-interactive backend is often the solution to dealing with the error:
qt.qpa.screen: QXcbConnection: Could not connect to display localhost:15.0