Creating and connecting to a remote desktop session

Video Tutorials

  • Instructions for Remote Visualization using a Mac OS

  • Instructions for Remote Visualization using Windows

All of the nodes in the visual partition have OpenGL capable GPUs that can be used for accelerated 3D rendering. To use these nodes you will need to install the TurboVNC client which can be downloaded at http://bluehound.circ.rochester.edu/CIRC/downloads. (Linux users can download their respective packages at TurboVNC at http://sourceforge.net/projects/turbovnc/files/1.2.2/)

When you start a TurboVNC server for the first time, you will be prompted for two passwords. The first password allows access to the remote desktop session. This password should be different from your bluehive password, but just as strong. You should never give this password out. The 2nd (optional) password is a view-only password and you can give this to collaborators with bluehive access if you want them to be able to view your remote desktop session.

The vnc_start command passes all of the command line options (except for -g and -dpi) to sbatch, so if you don't specify a timelimit using -t, you will get the default SLURM time limit of 1 minute. You can use -g to specify the resolution (geometry) of your remote desktop and -dpi to specify the dots per inch.

The vnc_start command also reserves nodes exclusively - so you will have the entire node to yourself for the duration of your job.

The easiest way to terminate your vnc server session is to double click the Logout Desktop icon. This will cancel your vnc server's slurm job. If you select Logout, it will terminate your gnome session, but keep the vnc server running until you scancel your job.

Automatic method

After you've successfully connected following the instructions in the Video - or in the Manual method described below - you can use the following commands to easily establish remote desktop sessions. Note that you should replace YourNetIDHere with your NetID. Also, these by default will ask for 480 minutes = 8 hours. If you want to modify the time limit - or request a higher memory node, or specify a different geometry, you can add additional options to the vnc_start command.

Windows

Install MobaXTerm and TurboVNC Viewer. Then within a MobaXTerm shell, you can cut and paste the following, which will ssh to bluehive, request a remote desktop session, establish the tunnel, and launch TurboVNC

  tunnelcommand=`ssh YourNetIDHere@bluehive.circ.rochester.edu "vnc_start -npp -t 480 | grep circ | sed 's/\s*#\s*//g;s/ssh/ssh -fNT/'"`; \
  $tunnelcommand; \
  /media/c/Program\ Files\ \(x86\)/TurboVNC/vncviewer.exe localhost:1; \
  killall -9 _ssh

You should verify that the TurboVNC Viewer was installed in "C:\Program Files (x86)\TurboVNC". On some systems it may be installed in "C:\Program Files\TurboVNC", in which case you would use

  tunnelcommand=`ssh YourNetIDHere@bluehive.circ.rochester.edu "vnc_start -npp -t 480 | grep circ | sed 's/\s*#\s*//g;s/ssh/ssh -fNT/'"`; \
  $tunnelcommand; \
  /media/c/Program\ Files/TurboVNC/vncviewer.exe localhost:1; \
  killall -9 _ssh

Mac OS

Install TurboVNC Viewer and open up the Terminal Application and use the following command (after replacing YourNetIDHere with your netid)

  tunnelcommand=`ssh YourNetIDHere@bluehive.circ.rochester.edu "vnc_start -npp -t 480 | grep circ | sed 's/\s*#\s*//g;s/ssh/ssh -fNT/'"`; \
  $tunnelcommand;  \
  open -n -W -a "TurboVNC Viewer" --args localhost:1;  \
  kill -s 9 `ps -A | grep -v grep | grep -m1 "$tunnelcommand" | awk '{print $1}'` 

Linux

Install gvncviewer using '''apt-get install gvncviewer'''. Then copy and paste the following command (after replacing YourNetIDHere with your netid).

  tunnelcommand=`ssh YourNetIDHere@bluehive.circ.rochester.edu "vnc_start -npp -t 480 | grep circ | sed 's/\s*#\s*//g;s/ssh/ssh -fNT/'"`; \
  $tunnelcommand;  \
  gvncviewer localhost:1;  \
  kill -s 9 `ps axu | grep -v grep | grep -m1 "$tunnelcommand" | awk '{print $2}'`

These scripts will facilitate starting a VNC X server, setting up an SSH Tunnel, and launching the VNC Client. If these scripts do not work, please follow the instructions for manually connecting.

Manual method

In what follows I will assume the user has ssh on their system. Windows users will need to install MobaXterm or Cygwin to use ssh, although putty takes the same command line arguments, or can be manually configured through the GUI menus.

  • Connect to Bluehive

    ssh YourNetIDHere@bluehive.circ.rochester.edu
    
  • Generate a password for TurboVNC.

    You will need to create a password to protect your VNC server session. To do so, run

    module load turbovnc
    mkdir -p ~/.vnc
    vncpasswd
    

    This will prompt you for an 8 character password. This password will grant access to your bluehive environment through the VNC server while it is running, so take the same precautions you would for your netid password. You will also have the option to create a view-only password. You could distribute this second password to other users if you want them to be able to connect and see your remote session, but not be able to control it.

  • Start the vnc server and the 3D X server on a gpu node.

    • Run the vnc_start script to submit a remote visualization job to the cluster, and start the X server. Here I am specifying the time (60 minutes) as well as the resolution (1440x900) and dpi (128) for my particular display.
      vnc_start -t 60 -g 1440x900 -dpi 128
      

      The script should print out something at the end like

      # ssh -L 5901:bhx0108:5901 YourNetIDHere@bluehive.circ.rochester.edu #
      

      You can copy the text between the '#' for pasting into your terminal later when you setup the tunnel. After you've copied the ssh command, make sure you exit from bluehive back to your local terminal.

      exit
      
  • Setup the ssh tunnel

    • SSH tunnels allow the vnc client on your machine - to listen on a local port and see the remote server running on a compute node in the bluehive cluster. The port used by TurboVNC is 5900 + the display number. So in this case this would be port 5902. Here we will initiate a tunnel from your local machine and not from Bluehive by pasting in the text we copied above
      ssh -L localhost:5901:bhx0108:5901 YourNetIDHere@bluehive.circ.rochester.edu
      

      This will start the ssh tunnel and then background the ssh connection. Note that I am having port 5902 from bhx0108, be tunneled to my local port 5901. I could have used any other available local port - but I am using the local port that corresponds to the first display. If I had multiple remote desktop sessions I would want to specify a different local port for each one. You'll want to keep this ssh tunnel open - so don't disconnect until you are done with your remote visualization.

  • Startup the TurboVNC client and point it at the correct local port

    • Launch the TurboVNC viewer and for the server enter
      localhost:1
      

      This corresponds to the local port 5901 that I used in my tunnel.

Using VirtualGL

  • Once you connect using TurboVNC, you still need to use VirtualGL to get accelerated 3D graphics by launching your application with vglrun. For instance to run the 'visit' application you would open a terminal and type
    module load virtualgl
    module load visit
    vglrun visit
    

    All of the 3D applications in the GNOME menu are setup to use vglrun as well.

Restarting the vnc server with a different resolution

  • To restart the vnc server you will need to login to bluehive (not using a terminal inside your VNC session) and run
    ssh bhx0108 /opt/TurboVNC/bin/vncserver -kill :2
    

    This assumes that the vnc server was running on bhx0108:2.

  • You can then start the vncserver with different geometry or dpi using (for example)
    ssh bhx0108 /opt/TurboVNC/bin/vncserver :2 -geometry 1920x1080 -dpi 157
    

Terminating your remote desktop session(s)

  • The easist way to terminate your remote desktop session is to double-click the Logout icon (red circle) on your desktop within the session you with to terminate.
  • To terminate all of your remote desktop servers on bluehive, you can open a terminal and run
    vnc_stop
    

    To terminate your particular session and release the node back to the cluster, you can open a new terminal inside your TurboVNC remote desktop session and run

    killall -u $USER
    

Extra reading

There are several ways to run graphical programs on bluehive and the best method will depend on the application, the type of visuals, and the specifics of your laptop and OS. Generally speaking there are 3 ways:

  • Remote 2D X Proxy
    • X2go and TurboVNC are examples of X proxies
    • They provide a 2D X server running on a remote host that then streams the compressed image back to a client.
  • X11 over ssh
    • Connect to bluehive with ssh -X
    • You must run your own X server locally.
    • Any linux operating system will have an X server
    • XQuartz is available for the Mac though it is slow.
    • Cygwin, Xming, (or MobaXterm) provide X servers for PC's.
  • GPU accelerated 3D rendering
    • This requires an X Server running on a computer with a GPU.
    • VirtualGL can be used to glue together a 3D X server and a 2D X proxy.

Quite often you will use several of these methods at the same time.

  • For instance, if you connect with X2go and then use the interactive script to run a graphical application on a compute node, the application will send X commands using the X11 protocol to the X Proxy on the login node, which then streams the resulting image back to your x2go client. This works well, but doesn't allow for 3D accelerated graphics.
  • You might also use "ssh -X" to get to bluehive and then to a compute node and then use your local GPU accelerated X Server. This allows for 3D acceleration, but relies on your own GPU as well as the GLX library which is becoming outdated and does not support many of the newer extensions.
  • You can also use X2go or TurboVNC to connect to a 2D X Proxy running on a compute node with an attached GPU, and then use VirtualGL to perform remote 3D accelerated rendering which produces a 2D image which is compressed and streamed back to the X2go or TurboVNC client.
  • Or if for some reason, you wanted to run the application on a separate node from the 3D X server, you could use X2go to connect to bluehive, and then use "ssh -X" to connect to a compute node without a GPU, and then use VirtualGL to do 3D accelerated drawing on another node with a GPU attached. The 3D instructions and the resulting image data would be sent back and forth using the X11 protocol to the X proxy running on bluehive, and then compressed and streamed back to your local machine, but all of this communication incurs a significant overhead, and is only necessary for remote visualization that requires more than 64 GB of memory.