Accessing GUI Applications on Chip Using X11 Forwarding
Some programs have a visualization component that may allow for things like graph or pdf viewing. This requires a few extra steps before using on the cluster.
Configuring X11 Forwarding Locally
Note that the below steps are not the only way to configure X11 Forwarding on your local machine, these are just ways we know work. If you find another way that works for you, that’s ok!
For Windows
You’ll need to install a windows oriented X-Server. For this tutorial we’ll use:VcXsrv Windows X Server. Go ahead and download the package.
From there, open the installer, and click through the default settings until you get to the installation folder. You may want to place this somewhere else (although you certainly don’t have to). Once you decided on the installation place go ahead and install, and close it once it’s completed. Once done, you’ll want to open xlaunch:
For most people, the default configuration is fine. Click finish, and then allow access.
Now open your terminal and enter the following:
$env:DISPLAY = "localhost:0"For MacOS
You’ll need to install a program called xquartz. This can be done with brew using the command brew install --cask xquartz or manually downloading and installing the xquartz dmg yourself.
Start by navigating to the xquartz project website and downloading the most recent version of the software. Once it’s downloaded, open it up and follow the installation instructions.
For Linux
No configuration is typically needed in a Linux Environment
X11 Forwarding on the Cluster
Once you’ve configured your local machine to accept graphical applications to be forwarded to your local machine, you’ll need to ssh to the cluster with two additional flags: -X and -Y
The command to ssh to the cluster should look something like:
ssh -X -Y ${USER}@chip.rs.umbc.eduThis will allow for your local machine to accept graphics from graphical applications. There won’t be an obvious way to tell that it worked, but you can test using the command xterm, which should open up a new terminal.
Note that the use of X11 forwarding is slow, and may take some time for the application to run. The stronger your internet connection, the faster this will run!
Creating a Slurm Allocation for X11 Forwarding
Now that we’ve verified that X11 forwarding is working for the login node, we’ll need to set up a slurm allocation for some of the compute resources. You may be familiar with the allocating resources page. You’ll want to run the srun (slurm run) command. This will start an interactive job with X11 forwarding enabled. An example might be the following:
Note that your flags should be in accordance with what cluster and resources you need.
[user1@chip ~]$ srun --cluster=chip-cpu --partition=general --qos=short --time=10 --mem=500 --x11 --pty $SHELL
The following have been reloaded with a version change:
1) slurm/chip-gpu/23.11.4 => slurm/chip-cpu/23.11.4
[user1@c18-44 ~]$As you can see from the above, we’ve been granted the node c18-44 with the resources we’ve requested, and are connected to said node.
Now we can check that xterm is working as expected:
Voila! X11 forwarding works on the slurm resource allocation, and you can forward any graphical application from the cluster to your local machine!