wiki:vnc3d/xpra

Xpra - X Persistent Remote Applications


Xpra (X Persistent Remote Applications)

... is a remote display solution for forwarding applications and desktop screens.
Applications forwarded by Xpra appear on the local desktop as normal windows (seamless mode),
rather than being all "trapped in a box together" (full desktop mode) like with VNC.
Xpra uses a custom protocol that is self-tuning and relatively latency-insensitive, and thus is usable also over worse links.
Xpra allows disconnection and reconnection without disrupting the forwarded application.

Xpra is an open-source software for multiple platforms (Linux, Windows, MaxOS, etc.).

Preparation

Download & Installation Xpra-client

Xpra can be downloaded for Windows, Linux and Mac from the official Xpra site:
http://www.xpra.org/trac/wiki/Download

Authentication

Xpra must communicate with JUWELS via Secure Shell (SSH) and JUWELS requires authentication to be password-less using SSH key-pair.
Please test your setup before you proceed.

Execute the command with your JUWELS-userid on your local workstation.
It must return the word 'success' for a successful SSH connection to JUWELSVIS.

Linux/MacOSX:
ssh <YOUR-USERID>@juwelsvis.fz-juelich.de echo "success"

Windows/Putty:
"C:\Program Files (x86)\PuTTY\plink.exe" -ssh <YOUR-USERID>@juwelsvis.fz-juelich.de echo "success"
Ensure you have loaded your key in PuTTY´s SSH key agent called Pagent before!


General approach using Xpra requires three steps.

  1. Start application in Xpra-server on a JUWELS login node.
  2. Connect with Xpra-client from your workstation to Xpra-server
  3. When your work is done, Check if Xpra-server stopped on the JUWELS login node.

1. Start application in Xpra-server

Login to any JUWELS login node and start application with Xpra-server. If you want hardware accelerated rendering, you need to login to a vis-login node.

In the following example we use juwelsvis02.fz-juelich.de. Before you can use Xpra, you must load the needed modules, which are, as of November 2020:

module --force purge
module use otherstages
ml Stages/2020  GCCcore/.9.3.0 xpra/4.0.4-Python-3.8.5

Then you can start an application via the "xpra" command:

  • simple X11 application
    jwvis02> xpra start --start-child=xterm --min-quality=90
    
  • OpenGL application
    jwvis02> xpra start --start-child="vglrun glxgears" --min-quality=90
    
    • using VirtualGL for hardware accelerated server-side rendering only works if a GPU with a running X-server is available
    • currently only on JUWELSVIS login nodes (juwelsvis00.fz-juelich.de to juwelsvis03.fz-juelich.de)

Take a note of the <DISPLAYID> and the <LOGFILE> Xpra returns:

> Actual display used: :<DISPLAYID>
> Actual log file name is now: <LOGFILE>

2. Connect the Xpra-client from workstation to Xpra-server on HPC system

Start the Xpra-client on the workstation to connect to the Xpra-server on JUWELS.

  • Connect using Xpra command line (primarily Linux or MacOSX)
    client> xpra attach ssh:<USERID>@<LOGINNODE>:<DISPLAYID>
    
  • Connect using Xpra GUI (primarily Windows)
    client> xpra_launcher
    

Mode = SSH
<USERID>@juwelsvis02.fz-juelich.de:22:<DISPLAYID>

3. Check if Xpra-server stopped

The Xpra-server shuts down automatically, when the application is closed.
Check if that is the case and stop it manually if required.

jwvis02> xpra list
jwvis02> xpra stop :<DISPLAYID>

Attention:
If you stop the Xpra-client without closing your application, your application keeps on running!
This can use cpu and memory resources others might need.

Real-case scenarios with Xpra

ParaView with full serverside rendering support using VirtualGL

jwvis02> module --force purge
jwvis02> use otherstages
jwvis02> ml Stages/2020  GCCcore/.9.3.0 xpra/4.0.4-Python-3.8.5

jwvis02> xpra start --start-child=xterm --min-quality=90

Now start load the necessary modules and start ParaView in the xterm:

xterm> module --force purge
xterm> ml Stages/2020  GCC/9.3.0  ParaStationMPI/5.4.7-1
xterm> ml ParaView/5.8.1-Python-3.8.5
xterm> paraview
xterm> # use 'vglrun paraview' for hardware accelerated rendering on juwelsvis

Atom
If you want to avoid to manually switch to another stage or load extra modules, you can follow this example.
Thanks goes to Johannes Hörmann.

A suitable xpra wrapper script can do the extra work before you program starts:

#!/bin/bash -x

module --force purge
module load Stages/Devel-2020  GCCcore/.9.3.0
module load xpra/4.0.4-Python-3.8.5
module load Atom/1.52.0

exec $@
  • Add the executable bit (chmod +x xpra_wrapper)
  • Add the line exec-wrapper = /absolute/path/to/xpra_wrapper to ~/.xpra/xpra.conf
    • if you have used xpra before, this file should already exist

Now you can bring up a remote Atom with this single command

client> xpra start ssh:<USERID>@juwelsvis02.fz-juelich.de --start-child="atom -w" --min-quality=90 --dpi=96

In order not to detach Atom from the calling process it needs to be started with -w option -- otherwise the xpra_wrapper would return immediately after initiating Atom and the xpra server shuts down.

More on Xpra

Full documentation of Xpra command: http://xpra.org/manual.html
Configuration Options: https://xpra.org/trac/wiki/Configuration

Usefull examples:

  • List all running Xpra-server:
    xpra list
    
  • Get all infos of a running Xpra-server:
    xpra info :<DISPLAYID>
    
  • Start Xpra-server with larger/smaller fonts
    xpra start --start-child="xterm" --dpi=96 --min-quality=90
    

any feedback welcomed - h.zilken@…, j.goebbert@…

Last modified 3 years ago Last modified on 11/20/20 14:16:57

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.