SSHing directly to a compute node at OSC - even if that node has been assigned to you in a current batch job - and starting VNC is an "unsafe" thing to do. When your batch job ends (and the node is assigned to other users), stray processes will be left behind and negatively impact other users. However, it is possible to use VNC on compute nodes safely.
The examples below are for Oakley.
Step one is to create your VNC server inside a batch job.
The preferred method is to start an interactive job, requesting an entire node, and then once your job starts, you can start the VNC server.
qsub -I -l nodes=1:ppn=12:gpus=2:vis
This command requests an entire GPU node, and tells the batch system you wish to use the GPUs for visualization. This will ensure that the X11 server can access the GPU for acceleration. In this example, I have not specified a duration, which will then default to 1 hour.
module load virtualgl module load turbovnc
Then start your VNC server. (The first time you run this command, it may ask you for a password - this is to secure your VNC session from unauthorized connections. Set it to whatever password you desire. We recommend a strong password.)
The output of this command is important: it tells you where to point your client to access your desktop. Specifically, we need both the host name (before the :), and the screen (after the :).
New 'X' desktop is n0302.ten.osc.edu:1
This option is less optimal, because it is slightly more difficult to get the hostname and screen. However, by submitting a non-interactive batch job, you can go away and have the system email you when your desktop is ready to be connected to, and more importantly if your SSH connection to OSC is somewhat unstable and intermittent, you do not run the risk of being disconnected during your interactive session and having your VNC server terminated. In general, it is recommended you only use this option if running via an interactive session is not feasible.
In order to start an VNC session non-interactively, you can submit the following script to the scheduler using qsub (adjusting your walltime to what you need):
#PBS -l nodes=1:ppn=12:gpus=2:vis #PBS -l walltime=00:15:00 #PBS -m b #PBS -N VNCjob #PBS -j oe module load virtualgl module load turbovnc vncserver sleep 100 vncpid=`pgrep -s 0 Xvnc` while [ -e /proc/$vncpid ]; do sleep 0.1; done
This script will send you an email when your job has started, which includes the hostname.
PBS Job Id: 935621.oak-batch.osc.edu Job Name: VNCjob Exec host: n0282/11+n0282/10+n0282/9+n0282/8+n0282/7+n0282/6+n0282/5+n0282/4+n0282/3+n0282/2+n0282/1+n0282/0 Begun execution
The screen is virtually always "1", unless someone else started a VNC server on that node outside of the batch system. You can verify the output of the vncserver command by using qpeek on a login node:
Where "jobid" is the batch system job number, for example, "935621".
Because the compute nodes of our clusters are not directly accessible, you must log in to one of the login nodes and allow your VNC client to "tunnel" through SSH to the compute node. The specific method of doing so may vary depending on your client software.
I will be providing the basic command line syntax, which works on Linux and MacOS. You would issue this in a new terminal window on your local machine, creating a new connection to Oakley.
ssh -L 5901:n0302.ten.osc.edu:5901 firstname.lastname@example.org
Open your VNC client, and connect to "localhost:1" - this will tunnel to the correct node on Oakley.
This example uses Chicken of the VNC, a MacOS VNC client.
The default window that comes up for Chicken requires the host to connect to, the screen (or port) number, and optionally allows you to specify a host to tunnel through via SSH. This screenshot shows a proper configuration for the output of vncserver shown above. Substitute your host, screen, and username as appropriate.
When you click [Connect], you will be prompted for your HPC password (to establish the tunnel, provided you did not input it into the "password" box on this dialog), and then (if you set one), for your VNC password. If your passwords are correct, the desktop will display in your client.