Viewing events remotely with VNC
Source the VNC setup script, and follow its instructions:
source /nashome/d/dbrailsf/setupVNC.sh
If anything is unclear, shoot me (Dom Brailsford: d.brailsford@lancaster.ac.uk) an email or slack message.
OLD INSTRUCTIONS
(Taken and adapted from Dom Brailsford DUNE wiki Instructions)
VNC provides you with a remote window to easily view GUIs from a remote machine with very little delayed response.
The new instructions require a little bit more setup than the old instructions (linked at the bottom of the page) but the setting up only needs doing once. If you get stuck, feel free to contact me (Dom Brailsford: d.brailsford@lancaster.ac.uk).
You need to do a few things prior to following the rest of the instructions:
- Pick a number for your VNC server (Pick any number between 0 and 99 -- in this example I'm going to use 22)
- Pick a sbndgpvm that you like to work on (I'm going to use sbndgpvm01 in this example)
- Install a VNC viewer on your local machine (Macs come with one already installed, an example of how to use it is shown at the bottom)
On your chosen sbndgpvm (i.e. ssh to it)
⚠️ NOTE: If you need to use a SL7 dev container, the VNC server should be started from the EL9 machine, then from the SL7 dev container you can do your work.
Firstly, check whether your chosen VNC server number is available. Run the following on the command line (change the 22 to the number you picked - do not forget the -localhost option. If you do, then your VNC session will be automatically killed by a cron job set up to detect these.):
vncserver :22 -localhost -bs
It will tell you if the VNC server already exists; pick a different number in that case and test again. If the specific server does not exist then it will be created (it may ask you to pick a password, remember it for later).
To check your already runing VNC server(s) on the machine you can run:
vncserver -list
To kill a tunning VNC server on the machine you can run:
vncserver -kill :N
where N
is the number associated to your VNC server in the example it would be 22
.
⚠️ NOTE: on EL9 VNC server is sourcing your ~/.profile
, so if there is anything that could cause a loop,
consider to amend your ~/.profile
(or temporarily rename it) otherwise your VNC could hung indefinitely.
On your local machine (i.e. open a new terminal window and do not ssh anywhere)
Add the following snippet to the bottom of your $HOME/.ssh/config. Change dbrailsf to your own kerberos principal, change the two occurrences of sbndgpvm01 to whatever sbndgpvm you chose at the start and change the 22 to your VNC server number (if your VNC number is between 0 and 9 then include a preceding 0 e.g. 00, 01, 02 etc.)
Host sbndgpvm01
HostName sbndgpvm01.fnal.gov
User dbrailsf
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
LocalForward 5901 localhost:5922
This snippet does a couple of things. Firstly, it allows you to connect to your chosen sbndgpvm without specifying your kerberos principal or the full address of the gpvm. In the case of the above snippet, the following ssh command connects me to sbndgpvm01
ssh -Y sbndgpvm01
Secondly, and more importantly, it automatically forwards the remote port used by the VNC server on the sbndgpvm to a specific port (5901 in the example above - you do not need to change this number) on your local machine.
You should now be permanently setup to use VNC.
How to use your VNC server
ssh to your chosen dunegpvm using its new shortened name e.g.
ssh sbndgpvm01
The ssh connection should automatically handle the port forwarding for you in the background. Now fire up root and open a TBrowser as a test.
source /cvmfs/sbnd.opensciencegrid.org/products/sbnd/setup_sbnd.sh
setup root v6_18_04d -q e19:prof
root
and once the root prompt appears
new TBrowser
On your local machine (open a new terminal window and do not ssh anywhere), open your vnc viewer software and point it towards localhost:5901. On a mac, the command is:
open vnc://localhost:5901
If you set a password when originally creating the VNC server on the sbndgpvm, you will be prompted for it. Hopefully you now see the TBrowser.
To use VNC from now on, you should only need an active ssh connection to your chosen sbndgpvm (e.g. when you're working on it) and a VNC viewer open and pointing to localhost:5901 on your local machine.
If you need to change the VNC display resolution (for example for a correct visualization of TITUS windows), you can set it from the menu at the top left: Applications -> System tools -> Settings -> Devices -> Displays. A higher resolution (e.g. 1920x1200, empirically on a Mac) should ensure to fully display the TITUS window within the VNC one.
ANCIENT INSTRUCTIONS
(Adapted from the 35 ton tutorials by Karl Warburton)
Generate some events to view
-
Go to your data area and create an area for this work.
cd /sbnd/data/users/< username >/ mkdir workspace cd workspace
-
Generate 10 single muon events.
lar -c prodsingle_sbnd.fcl -n 10
-
Run GEANT4 on the output (... = "Tab").
lar -c standard_g4_sbnd.fcl -s prodsingle...
-
Run the detector simulation on the output.
lar -c standard_detsim_sbnd.fcl -s prodsingle..._...
-
Run the reconstruction on the output.
lar -c standard_reco_sbnd_basic.fcl -s prodsingle..._..._...
Viewing events with VNC
Running GUIs (e.g. TBrowser, Event display) on the gpmvs can be very slow, using a VNC server speeds things up significantly.
-
To configure this we will need two terminals open. Terminal 1 = terminal logged in to one of the sbnd gpvms. Terminal 2 = terminal on your local machine.
-
Terminal 1: Start the VNC server (replace X with a number, must be different for everyone working on the same gpvm).
vncserver :X -localhost
-
Terminal 1: Choose a password.
-
Terminal 1: Push the output of a remote terminal to the VNC desktop.
export DISPLAY=localhost:X
-
Terminal 2: Tunnel the VNC through ssh to keep it encrypted (if X<10 add a zero to the front).
ssh -L 59X:localhost:59X -N -f -l < username > < gpvmaddress > # e.g. ssh -L 5908:localhost:5908 -N -f -l tbrooks sbndgpvm01.fnal.gov #
- Terminal 2: Open the window locally.
-
On mac the command is.
open vnc://localhost:59X
-
On linux/ubuntu we will use vinagre but you might need to download it first.
sudo apt-get install vinagre vinagre vnc://localhost:59X
-
A desktop window should open up.
-
-
Terminal 1: Open the event display.
lar -c evd_sbnd.fcl prodsingle..._..._..._...
- The event display should appear in the desktop window.