Skip to content

X Forwarding

Normally any generated data would be saved to a file and you download that to your local machine for viewing, or post processing. However, sometimes the data can’t be reduced and you need to visualise some aspect of it in-situ. To display some graphics from a program running on the HPC onto your local machine you need to do a thing called “X forwarding”.

Start SSH with X Forwarding Enabled

When you start SSH from the command line you need to use the -X option to enable X forwarding like this:

$ ssh -X u999777@xxx.xx.xx.xx

Now your on the login node you can test X forwarding is working as decribed in the section below.

If you need to login to an execution node because your job will be using significant CPU and memory then you can use -X with an PBS interactive job submission request. See: Logging into Other Nodes. An example is:

$ qsub -I -X -l select=1:host=hpcnode07 -l walltime=00:30:00

Testing X Forwarding

To test that X forwarding is working we can start the R programming language and get it to display a simple graph.

Start R:

hpcnode01$ R
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
Type 'q()' to quit R.

Display a histogram of 100 random gaussian variables:

> hist(rnorm(100))

The following graph should appear:


Close the graph window and then exit R:

> q()
Save workspace image? [y/n/c]: n