X11 Forwarding

X11 Forwarding on SeaWulf

What is X11 Forwarding?

X11 forwarding allows you to run GUI applications on SeaWulf while displaying them on your local computer. It works through the X11 windowing protocol, which sends graphical output from the cluster to your local desktop. This is commonly used for visualization tools, plotting software, or interactive applications that require a graphical interface.

Installing an X Window Server

Before using X11 forwarding, you must have an X server installed locally. The X server receives and displays graphics from remote applications. Follow the setup instructions below for your operating system.

Windows (MobaXterm)

MobaXterm (Recommended):

  • Includes a built-in X server with SSH integration
  • Minimal setup required
  1. Download and install MobaXterm Home Edition.
  2. Ensure "X11 server" is enabled (default setting).
  3. Create a new SSH session:
    • Remote host: login.seawulf.stonybrook.edu
    • Specify username: your NetID
    • Enable "X11-Forwarding" under Advanced SSH Settings
  4. Connect and test using glxgears.

macOS (XQuartz)

XQuartz:

  • Standard X11 implementation for macOS
  • After installing version 2.7.9 or later, enable indirect GLX (required for 3D graphics):
defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

Then restart XQuartz.

  1. Start XQuartz.
  2. Connect to SeaWulf with X11 forwarding:
ssh -X <your_netid>@login.seawulf.stonybrook.edu
  1. Test your setup:
glxgears

You should see a small window with rotating gears.

Linux

Most Linux distributions include X11 by default.

  1. Open a terminal and connect to SeaWulf with X11 forwarding:
ssh -X <your_netid>@login.seawulf.stonybrook.edu
  1. Test your setup:
glxgears

Using X11 with SLURM Jobs

Option 1: Interactive Jobs with X11

Step 1: Load SLURM and request a compute node:

module load slurm
salloc -N 1 -p short-40core

Step 2: Once allocated, SSH into the node with X11 forwarding:

ssh -X $SLURM_NODELIST

Option 2: SeaWulf Desktop via Open OnDemand

Some GUI applications may perform better with the SeaWulf Desktop app in Open OnDemand.

  1. Log in to Open OnDemand
  2. Select SeaWulf Desktop
  3. Choose runtime, queue, and other options
  4. Once the job starts, launch the desktop session
  5. Use the terminal within the desktop to run GUI applications
Note: Applications like RStudio are better run through their dedicated Open OnDemand apps rather than via X11.

Switching Between Nodes

X11 forwarding applies per SSH connection. When moving to a different node, reconnect using ssh -X.

To another login node:

ssh -X <your_netid>@milan1.seawulf.stonybrook.edu

To a compute node:

ssh -X <your_netid>@compute-node-name

Tips and Troubleshooting

  • Each new SSH or SLURM session requires a fresh -X or -Y connection
  • Verify your X server is running locally
  • Ensure the DISPLAY variable is set correctly (echo $DISPLAY)
  • Test with glxgears or GUI tools like Matplotlib or MATLAB

If no window appears, your local X server may not be active or X11 forwarding may not be enabled in your SSH connection.