Working with Visualizations and GUI Applications on the HPC Clusters IntroductionTo work with visualizations or graphical user interfaces (GUIs) on the clusters, we generally recommend using our visualization nodes.Our visualizations nodes have more powerful resources than the average personal computer (more CPUs, a powerful GPU, and more memory) to run visualization software. They are also an ideal place to work with the various programs on our clusters that use graphical user interfaces (GUIs), such as Firefox, xterm, eog, ncview, nsys-ui, DDT, xmgrace, gnuplot and many more.If you are working on Adroit, Della, or Stellar, please follow the instructions in Option 1.If you are working on Tiger, please follow the instructions in Option 2. If you are working on Nobel or Traverse, please follow the instructions Option 3. Option 1 - Virtual Desktop (with OnDemand)This option is the most simple to set up, and is recommended for users working on Adroit, Della, or Stellar. (Tigressdata users please see Option 2 below.)This setup allows you to run a virtual desktop on our visualization nodes that is optimized for faster processing of visualizations. In this case the virtual desktop runs in a web browser on your computer.To launch a virtual desktop session:Point your browser to the link associated with your cluster.*Note that VPN is required if you're trying to connect from off-campus.* https://myadroit.princeton.edu https://mydella.princeton.edu https://mystellar.princeton.eduFrom the orange menu bar,i. click on "Interactive Apps"ii. select "Desktop on Della Vis Nodes" or "Desktop on Stellar Vis1 node" or "Desktop (Visualization Node)"If you select "Desktop (Compute Node)" instead, note that these 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)" type options.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.You can launch a terminal by clicking on the black terminal icon which is next to the orange Firefox icon. The virtual desktop is provided by a software container, meaning you will be able to access software that you install in your account.Option 2 - Virtual Desktop (with Turbo VNC)This option is recommended for users working on Tigressdata.Like option 1, this setup also allows you to run a virtual desktop on our visualization nodes that is optimized for faster processing of visualizations. In this case, however, the virtual desktop runs on the TurboVNC application that you'll download on your computer.TurboVNCTo install and make use of TurboVNC on the clusters, see our TurboVNC Installation Instructions. Although it takes a few minutes to install and configure it, you will find that the performance is excellent. TigerVNCWhile TurboVNC has proven successful, users may also consider trying TigerVNC.Option 3 - Command Line (with X11 Forwarding)This option is recommended for users of Nobel or Traverse, or the clusters which do not have associated visualization nodes.(While users of other clusters–Adroit, Della, etc.–could also use this option, it is only appropriate for basic visualization or GUI needs. If you need anything more advanced, we highly recommend using Option 1 or 2 instead.)To use visualization or graphical applications through the command line, you must follow these two steps:Have an X server installed and running on your local machine.Which X server application you download depends on your personal computer's operating system. We suggest the following options for each operating system:- 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.Visit the OIT Tech Clinic if you need help with installing and configuring these programs.After downloading and installing your X server software, make sure it is open and running before proceeding. Connect to the desired node with the 'ssh' command and '-X' option.You can follow our Connect by SSH guidelines and add a -X or -Y option to the command.For example, if working on Nobel, a user with the Princeton NetID abc123 would connect to Nobel with the following 'ssh' command:$ ssh -X [email protected] In some cases connecting with -X fails while using -Y works. The -Y option enables trusted X11 forwarding:$ ssh -Y [email protected]If you are connecting from off-campus then additional steps are necessary. Error MessagesIf 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 specifiedError: Can't open display:Gtk-WARNING **: 21:27:55.100: cannot open display:Cannot load backend 'TkAgg' Make Sure You Are Not Over QuotaOne 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.MatplotlibIn 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/2022.5 $ 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/2022.5 $ 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.0Additional OptionsInteractive Slurm AllocationsIf 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 --x11See additional material on salloc.Command Line (with Xpra)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://[email protected] --start=xterm --opengl=noThis 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 protected]/ --opengl=noSee more use cases.