X-Window

Z MetaCentrum
Skočit na navigaci Skočit na vyhledávání
Metacentrum wiki is deprecated after March 2023
Dear users, due to integration of Metacentrum into https://www.e-infra.cz/en (e-INFRA CZ service), the documentation for users will change format and site.
The current wiki pages won't be updated after end of March 2023. They will, however, be kept for a few months for backwards reference.
The new documentation resides at https://docs.metacentrum.cz.


This article describes a low-level method of how to run GUI applications on Metacentrum. Only system tools are used and it is therefore simple, always available and bulletproof, but has also a few drawbacks. X-Windows connection will use all available bandwidth, can se used to run a single application only and if the session crashes, it cannot be reconnected. It is fairly useful over a LAN or if you need to run just single application. If you need a more bandwidth- and latency-optimized alternative, or if you want the session to be reconnectable, use Remote desktop or OnDemand.

X-window is a system for sharing the graphical interface of applications through network. In Metacentrum you can use it for accessing the graphical interface of certain applications, e.g. Matlab, from the user's desktop.

In general

GUI of unix systems are build on X-Window system, which supposes, that a program and his GUI run on different computers in net. Programs in X-Window system display their GUI on so called X-server which is defined by environment variable DISPLAY.

For example: We are sitting in front of computer named jenicek and start up X-Window program in machine called marenka. If we set variable DISPLAY=jenicek:0 on marenka and if X-server is running in jenicek, execution of a program will be running in a remote computer, but will be displaying on screen in front us and reacting on keyboard an mouse on our table.

There are X-servers for MS Windows, for example Xming, Cygwin/X, X-Win32, Exceed.

X-protocol tunneling

Windows

PuTTy setting for X11 tunnel
  1. Install Xming. Run it.
  2. Install PuTTy. Run it.
  3. Set the connection parameters in PuTTy according the image on the right and click "Open".
  4. Once you have a terminal window, proceed as a Linux user.

Linux

The simplest way how to use X-window in MetaCentrum is to submit an interactive job with X-protocol tunneling enabled by running both ssh -X and qsub -X.

jenicek$ ssh -X skirit.metacentrum.cz
skirit$ qsub -X -I -l select=1:ncpus=2:mem=4gb:scratch_local=10gb -l walltime=1:00:00 -l matlab=1
konos6$ module add matlab ; matlab

The graphical output should appear on your screen.

If you get error informing about missing rights to use Xserver occurs, logout both from interactive job and a frontend, type

jenicek$ xhost +

and repeat the procedure described above.

Direct connection by X-protocol

Direct connection is faster than tunneling through SSH, but it cannot be used when NAT (network address translation) is applied, as is typical for routers and local networks. This method is therefore limited only to certain situations and cannot be taken as equivalent of the one described above.

Direct connection by X-protocol is achieved by setting the DISPLAY variable on the computing machine to the IP address of your personal machine:

jenicek$ ssh skirit.metacentrum.cz
skirit$ qsub -I -l select=1:ncpus=2:mem=4gb:scratch_local=10gb -l walltime=1:00:00 -l matlab=1
konos6$ echo $DISPLAY
konos6$ export DISPLAY=jenicek.ics.muni.cz:0
konos6$ module add matlab ; matlab

On your machine (jenicek.ics.muni.cz in this example) you have to allow incoming connections by

jenicek$ xhost +

and make sure that your X-server does not have disabled incoming connections. For example, the standard setting on Ubuntu is to start X-server with the options -nolisten tcp that disables incoming connections.