Using Graphical Windows with Euler

Example running Matlab with figures/windows:

ssh -X nethz@euler.ethz.ch
# -XF allows gui X11 forwarding
# -Is opens an interactive terminal
bsub -XF -R "rusage[mem=3000]" -Is xterm
# Wait until job starts

matlab -nodesktop
# Wait until matlab terminal starts
figure
# Window should pop up

exit() # To leave the matlab terminal

Check each time that you are not on a login node before starting matlab(!)
You can also start matlab just with matlab and this opens the usual window. This can be quite slow and is usually not necessary.

More details: https://scicomp.ethz.ch/wiki/X11_forwarding_batch_interactive_jobs

GUIs in Windows with WSL

This is possible in Windows with X11 forwarding. X11 is a window system in linux.

The way it works is VcXsrv (a X11 Server) will convert the X11 windows to Windows windows. Not all graphical applications will work, but there are many that do work (namely the Matlab example above).

  1. Install VcXsrv from https://sourceforge.net/projects/vcxsrv/
  2. Start the server/service by running XLaunch from the windows menu
  3. The default settings are fine, so just press enter many times until its finished.
    • Note: when using Euler you may need to “Disable Access Control” to allow for anyone to connect
    • VcXsrv will now be a tray icon, where you can close it as well
    • This needs to be running whenever you want to start a GUI from wsl
  4. echo "export DISPLAY=0.0.0.0:0.0" >> ~/.bashrc
    • This tells wsl where the display is
  5. Reopen the wsl terminal

That’s it! To test that its working you may want to test it with gedit or nemo the file browser and a window will pop up:

sudo apt install gedit nemo
gedit
nemo
# Also works
code
subl

The Matlab example above works with these steps. Essentially the job forwards the X11 to the SSH session which forwards it to wsl which forwards it to VcXsrv.

Follow the exact steps here starting at “And now we’re going to the graphical part…”