X11 Forwarding

The clusters at Princeton run Springdale Linux and use the X11 window system. One common hurdle experienced by users as they begin to use remote computational resources is the lack of a GUI. While this can be overcome by using a VNC server and client, sometimes this is too heavy weight a solution. An example of where some graphical capabilities are needed without really wanting a whole desktop session is the inspection of graphical output of a computational job.

=== Prerequisites ===
* you have an account on one of the [http://www.princeton.edu/researchcomputing/computational-hardware/ research computing clusters at Princeton]
* you have a working SSH setup on your current machine and are able to log into the server

===Remote Machine Setup===
On Della or Tukey, for example, there is nothing you need to do.

=== Local Machine Setup ===
Depending on your operating system, there are different steps for you to follow in order to forward the images from the remote X11 server to your local machine. See the platform-specific instructions below.

==== Linux or Mac OS X ====
If you are using a Unix-like environment (including Cygwin, although this isn't exactly the same) you need to edit the SSH client's configuration. For a user-specific change, edit the file ~/.ssh/config (and if it doesn't exist, create it).

The contents of this file should be:

Host *
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes

"ForwardAgent" isn't critical for the present concern, but enables other useful functionality.

If you are on the Mac operating system and don't have an X11 server, see [http://xquartz.macosforge.org/trac http://xquartz.macosforge.org/trac].

==== Windows ====
Assuming you use PuTTY on Windows, you need to edit the settings under Connection > SSH > X11 and enable X11 forwarding.
PuTTY configuration

However, you still need a local X server. You can get one for Windows . After installing Xming and making sure the server is running you are ready to view X windows from a computational cluster on your Windows machine.

=== Example Usage ===
==== Viewing PDFs ====
On one of the clusters, imagine you've created some plots in R and saved them as a PDF. However, you don't want to rsync between local and remote just to check the graphical output. Instead you can forward the X window for the PDF viewer from the server to your local machine. Assuming the above setup, just run UNIX command:

evince http://q-aps.princeton.edu/q-aps/files/BasicHPC-Della.pdf

where the first component is the evince application and the argument is the PDF file. This example loads Della documentation from the Q-APS website and forwards the evince window to your local machine which is connected to a computational cluster.


==== Viewing R Graphs ====
In the first example, we already produced PDF files which might arise in the case where we create graphs as part of a computational job submitted to Torque. However, many times we want view graphical output while still in an interactive R session. This is handled just as easily. Start R on the head node of one of the clusters. Create a plot with the following R command:

plot(rnorm(45))

This example shows the R plot being forwarded to your local machine.