X11 GUI Forwarding
Some applications provide the capability to interact with a graphical user interface (GUI). It is not typical of parallel jobs, but large-memory applications and computationally steered applications can offer such capability.
Setting up X Forwarding
First we must login to SCW with X Forwarding enabled.
$ ssh -X username@hawklogin.cf.ac.uk
Windows users will need to go to the Connection->SSH->X11 options and enable “Enable X11 Forwarding”. You will also need an X server such as VcXsrv or XMing.
Mac users will need to download Xquartz.
There are two ways to run graphical jobs on the system:
SSH into the node
Alternatively you can SSH directly into a node you’ve been allocated via salloc. By adding the -X option to this the X session will be forwarded from the compute node back to the login node. This is shown in the example below.
[username@cl2 ~]$ salloc -n 1 salloc: Granted job allocation 30937 salloc: Waiting for resource configuration salloc: Nodes ccs0046 are ready for job [username@cl2 ~]$ ssh -X ccs0046 xterm
Use srun
Note: this method is not currently working
With Slurm, once a resource allocation is granted for an interactive session (or a batch job when the submitting terminal if left logged in), we can use srun to provide X11 graphical forwarding all the way from the compute nodes to our desktop using srun -x11 <application>.
[username@cl2 ~]$ salloc -n 1 salloc: Granted job allocation 30937 salloc: Waiting for resource configuration salloc: Nodes ccs0046 are ready for job [username@cl2 ~]$ srun -x11 xterm
Note that the user must have X11 forwarded to the login node for this to work – this can be checked by running xclock at the command line.
Additionally, the -x11 argument can be augmented in this fashion –x11=[batch|first|last|all] to the following effects:
- -x11=first This is the default, and provides X11 forwarding to the first compute hosts allocated.
- -x11=last This provides X11 forwarding to the last of the compute hosts allocated.
- -x11=all This provides X11 forwarding from all allocated compute hosts, which can be quite resource heavy and is an extremely rare use-case.
- -x11=batch This supports use in a batch job submission, and will provide X11 forwarding to the first node allocated to a batch job. The user must leave open the X11 forwarded login node session where they submitted the job.