Connecting to CSD3 via TurboVNC (3D Visualisation)

Important

The graphical visualisation nodes gpu-e-1,…, gpu-e-7 retired on Monday 10th July 2023 and were replaced by new NVIDIA L40 nodes gpu-r-1,…, gpu-r-10.

Starting a new VNC session

The recommended form of remote desktop uses the freely downloadable software TurboVNC. This is because TurboVNC, which is centrally installed on CSD3, contains an improved codec for better transmission of rapidly varying 3D images. Hardware accelerated 3D (see below) will still work with other forms of VNC (or e.g. X2Go), although in these cases the performance may be decreased depending on the codecs available for compressing and decompressing the desktop images.

Since 3D visualisation-capable graphics cards are only attached to a subset of nodes, in order to use 3D the TurboVNC server should be started on one of these nodes. Please see the startgfx section for instructions for launching and managing these specialised remote desktops, however the general descriptions of first-time password setting and the SSH-tunnel method of connecting to the remote desktop that follow remain applicable in the 3D case. You will probably wish to try creating a non-graphical remote desktop initially.

If you don’t plan to make use of 3D graphics, then you should launch a VNC session on an ordinary login node as follows.

To start a VNC session, first ssh/PuTTY in your usual way to a CSD3 login node. Obviously it is best to choose a relatively non-busy node (the commands top or w will display current system load). Then do:

vncserver

(where in the default environment this will refer to the correct version of VNC).

The first time you run this you will be asked to set a VNC password. Note that this is not your login password and should be set to something different (but still strong) - its purpose is to protect your remote desktop from access by other users who are already logged into the cluster. You will also be asked for a second, optional password which can be shared with others if you want to give someone else the ability to see, but not change, your remote desktop, e.g. to show them some simulation result - this need not be set. Once you have set a VNC password it will be stored in your home directory and you will not be asked to set it again (unless you delete the ~/.vnc/passwd file).

The vncserver command will start a VNC session on the next available display number. The name of the display will be reported by the vncserver command in the form hostname:N where N is the display number. You will need to note the display number, and also remember the hostname in order to connect to the correct desktop later.

Note that vncserver -list will list active sessions belonging to you which are running on the same node, and -kill can be used to terminate a specified display number (for the 3D desktops, the showgfx and killgfx special commands make this easy).

Having launched a VNC session on a login node, it is possible to log out of CSD3 while leaving the session, and applications within the session, running and to reconnect to it later, perhaps from a different location. Please try not to create multiple sessions on different nodes by accident - there is no reason for anyone to have more than one operating at a time since a single virtual desktop can display applications running on any CSD3 node (like any X windows display).

Connecting to an existing VNC session

This subsection deals with connecting to a pre-existing VNC session from your local client machine. The client software can be downloaded from the web site (.deb and .rpm files for Debian or RedHat-style Linux distributions respectively, .exe for MS Windows, .dmg for MacOSX). For example, to connect to VNC display :N on login-e-10 as user abc123, one might do from Linux:

/opt/TurboVNC/bin/vncviewer -via abc123@login-e-10.hpc.cam.ac.uk localhost:N

where this assumes that the TurboVNC executables have been installed in their default location. This should first prompt for the normal login password to establish an SSH connection to CSD3, then prompt for the VNC password. The VNC connection is being tunnelled automatically through the initial SSH connection.

In the 3D desktop case, the localhost in the above should be replaced by the name of the graphical node running the desktop, and the choice of login node in the specification of the tunnel becomes irrelevant.

Manually creating a SSH tunnel

Some alternative VNC clients also support automatic tunnelling - the role of the login node in these cases may be described as the gateway or jump host.

If automatic tunnelling is not supported by the VNC client, it becomes necessary to perform an additional step in order to manually forward local port 5900+N (where N is the VNC display number) to the same port number at the VNC server host (in the above example, assuming the display number is 1, this would be from local client port 5901 to localhost port 5901 on login-e-10). On the Cygwin or Windows command line (similarly on MacOSX, and indeed on Linux if you wish to avoid the -via option) this tunnel can be created by doing:

ssh -L 5901:localhost:5901 abc123@login-e-10.hpc.cam.ac.uk

(effectively this is what the Linux vncviewer -via option does internally). The equivalent step is also possible with PuTTY. Keeping the login session which this creates open, in the general case with display number N you would then connect your local TurboVNC client to localhost:N. The SSH tunnel ensures that the connection is actually made (securely) to the correct VNC session.

Once again, in the 3D desktop case, the localhost in the above should be replaced by the name of the graphical node running the desktop, and the choice of login node in the specification of the tunnel becomes irrelevant.

If connection is successful, an XFCE desktop session should then appear inside a window on your local machine.

Using 3D graphics

Post-processing of large data sets may require interactive visualisation software using 3D graphics hardware. Such applications are frequently written using the graphics programming standard OpenGL and for usable interactive performance require the services of a real GPU in order to generate images sufficiently quickly. Furthermore, this GPU typically needs to be on the machine running the application - a high quality GPU on your local machine is usually no help. The HPC clusters have a set of graphical nodes, each equipped with multiple NVIDIA GPUs, for this purpose.

In order to use 3D graphics, first establish a VNC session as described in the section startgfx. Then on the remote desktop, launch the graphical application with vglrun, e.g.

vglrun glxgears &

will launch a simple 3D application showing rotating gears. Note that starting such an application without vglrun leads to an error, because the remote desktop by itself cannot process the OpenGL 3D drawing instructions, but the vglrun (which is part of VirtualGL) will intercept and redirect the 3D instructions to the GPU, and paint the rendered images back to the remote desktop.

Note that when using TurboVNC, F8 brings up a useful control panel, including a way to change the level of image compression on the fly which can increase the responsiveness of 3D applications by trading off image quality (the default is tight + perceptually lossless JPEG which is probably fine for the CUDN; from home broadband I generally find tight + medium quality JPEG works better if I am running 3D applications). Note also the Request lossless refresh option which forces an instant update of the desktop without compression (thereby removing any imperfections due to lossy compression). On the Windows client these features are accessed from the top menu bar.

startgfx

The 3D visualisation-capable nodes are currently a set of specialised nodes each containing four NVIDIA L40 GPUs, 1TiB of RAM and 64 Ice Lake CPUs. This means that the remote desktop in this case is running on a non-login node, which changes some details of launching and connecting. Once connected to the remote desktop, usage proceeds as described above in Using 3D graphics.

To simplify launching, locating and terminating 3D remote desktops, there are three commands which can be run from any login node:

startgfx

showgfx

killgfx nodename:displaynumber

As suggested by the names, startgfx will launch a new remote desktop on a random member of the 3D-capable set of nodes, and print out helpful information such how to connect to and how to terminate the desktop.

Note that if this is the first time VNC has been launched by the user, they will be prompted to set one or more VNC passwords, as described in Starting a new VNC session. startfx will also print the version of the vncviewer command line required to connect from Linux or MacOS as described above in Connecting to an existing VNC session, but if using other clients manual configuration of a jump host or SSH tunnel will be necessary as described in Manually creating a SSH tunnel.

startgfx will complain and decline to start a second desktop if it detects that the same node is already running one for the same user, as this is usually wasteful and unintentional.

showgfx will find and list any 3D desktops owned by the same user.

killgfx (or equivalently, stopgfx) will terminate the 3D desktop specified by its node name and display number.