Some applications on the HPC clusters have a GUI or graphical user interface. These include Firefox, xterm, eog, ncview, nsys-ui, DDT, xmgrace, gnuplot 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 Clinic 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 log in 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.
Interactive Slurm Allocations
If you need to use graphics on one of the compute nodes then use the salloc command with the --x11 option:
$ salloc --nodes=1 --ntasks=1 --mem=4G --time=00:20:00 --x11
See additional material on salloc.
One can work with graphical applications on Adroit, Della and Stellar using a virtual desktop.
Below is the procedure for launching a virtual desktop session:
- Point your browser to https://myadroit.princeton.edu (VPN required from off-campus), https://mydella.princeton.edu (VPN required from off-campus) or https://mystellar.princeton.edu (VPN required from off-campus).
- From the orange menu bar click on "Interactive Apps" and select "Desktop" or "Vis1/Vis2 Desktop". You'll get a form for requesting a session. Set the required number of hours, etc.
- Consider checking the option to get an email notification when the desktop has been created.
- Once your virtual desktop has been created click on the blue "Launch Desktop" button to start your session.
Note that the "Desktop (Compute Node)" 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. The Internet is accessible for the "Desktop (Visualization Node)" option.
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 email@example.com.
If you have an acount on Della, Stellar, Tiger or Traverse then consider installing TurboVNC on your local machine (e.g., laptop) which offers far better performance than X11 forwarding. For Della or Tiger, you connect to tigressdata.princeton.edu using TurboVNC, launch a terminal on tigressdata (click on black terminal icon) and then ssh -X to the desired cluster from tigressdata. For Stellar and Traverse, users can connect directly (please favor the vis nodes on Stellar). 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.
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.
While TurboVNC (see above) has proven successful, users may also consider TigerVNC.
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