Difference between revisions of "Ifarm graphic mode"

From Hall A Wiki
Jump to: navigation, search
Line 31: Line 31:
 
First you need to start a vncserver on ifarm1401
 
First you need to start a vncserver on ifarm1401
  
  ssh -XY your_lab_username@ifarm1401 (login with Xwindow forwarding enabled)
+
  ssh -XY your_lab_username@ifarm1401.jlab.org (login with Xwindow forwarding enabled)
 
  mkdir .vnc
 
  mkdir .vnc
 
  edit .vnc/xstartup with lines below
 
  edit .vnc/xstartup with lines below
Line 40: Line 40:
 
         metacity &
 
         metacity &
 
  chmod 755 .vnc/xstartup
 
  chmod 755 .vnc/xstartup
  vncserver                          (start vnc server, give a password if running it first time, note the port number output on screen)
+
  vncserver                          (start vnc server)
  ( '''make sure to kill the server after you using it to free resource on ifarm,'''
+
('''give a password if running it first time, note the vnc server port number output on screen
  '''otherwise it will keep running even after you log out!''')
+
  make sure to kill the server after you using it to free resource on ifarm,
 +
  otherwise it will keep running even after you log out!''')
 
  vncserver -kill :port        ('''replace port with correct port number, note the space before colons''')
 
  vncserver -kill :port        ('''replace port with correct port number, note the space before colons''')
  
== connect by vncviwer ==
+
== run vnc viewer ==
  
Next you need to connect to vncserver on ifarm1401 by vncviwer
+
Next you need to connect to the vnc server on ifarm1401 by a vnc viwer
  
 
The simple way is to use vncviewer on ifarm to test see if your vncserver runs ok. It's slow if your machine is not at jlab network
 
The simple way is to use vncviewer on ifarm to test see if your vncserver runs ok. It's slow if your machine is not at jlab network
  
 
  ssh -XY your_lab_username@ifarm1401 (login with Xwindow forwarding enabled)
 
  ssh -XY your_lab_username@ifarm1401 (login with Xwindow forwarding enabled)
  vncviewer localhost:1              (use other port number if not 1 in last step)
+
  vncviewer localhost:port            (replace port with correct vnc server port number)
 +
 
 +
The best way is run vncviewer on your machine anywhere through ssh tunneling
 +
 
 +
for linux, run "yum install tigervnc" to install vncviewer
 +
for windows, download [http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html putty] and https://www.realvnc.com/en/connect/download/viewer/ vncviewer]
 +
built ssh tunnel with port number of vnc server as follows
 +
  "ssh -X -N -g -L 5999:localhost:port your_lab_username@ifarm1401.jlab.org" if your linux machine is at jlab
 +
  "ssh -X -N -g -L 5922:ifarm1401:22 your_lab_username@login.jlab.org" and "ssh -X -N -g -L 5999:localhost:port your_lab_username@login.jlab.org" if your linux machine is at jlab
  
The best way is run vncviewer on your machine which can be anywhere through ssh tunneling
+
vncviewer localhost:99

Revision as of 17:46, 12 March 2018

For any question, email Zhiwen Zhao zwzhao@jlab.org

Why

Usually we are running code on ifarm without caring about graphic because it's used for a test ground for farm job anyway.

Sometimes we do want to test a code's graphic feature. For example, it's a common system we all have access and can be used for debug.

Xwindow forwarding (not recommended)

It is simply use Xwindow forwarding by ssh into ifarm and run the code.

Xwindow graphic is always rendered in your local machine. This is not only very slow if your machines is outside of jlab network, but also can have different results for different people because their local machines are different. Sometimes, it can even cause crash of your local machine if your code is not nice and your local machine is very different from ifarm.

ssh -XY your_lab_username@ifarm          (login with Xwindow forwarding enabled for linux and Mac)
xclock &                                 (test if Xwindow forwarding works)                                            
If you local machine is windows, you need to have a Xwindow server like Xming-mesa running. You also you need to enable Xwindows forwarding in putty option to use ssh
If you local machine is Mac, you need to have a Xwindow server installed and enabled

vnc (recommended)

tested on ifarm1401 and ifarm1402 as of 2017/05

The better way to do it is through a vnc server inside ifarm. This way the code won't crash because it runs within the same environment where it is compiled and everyone will see same result. Here is how to do it

You need to use ifarm1401 or ifarm1402 explicitly, ifarm is an alias to both and would cause confusion. I use ifarm1401 as an example below.

start vnc server

First you need to start a vncserver on ifarm1401

ssh -XY your_lab_username@ifarm1401.jlab.org (login with Xwindow forwarding enabled)
mkdir .vnc
edit .vnc/xstartup with lines below
        #!/bin/sh
        xsetroot -solid grey
        vncconfig -iconic &
        xterm -geometry 160x50+10+10 -ls -title "$VNCDESKTOP Desktop" &
        metacity &
chmod 755 .vnc/xstartup
vncserver                           (start vnc server)
(give a password if running it first time, note the vnc server port number output on screen
make sure to kill the server after you using it to free resource on ifarm,
otherwise it will keep running even after you log out!)
vncserver -kill :port         (replace port with correct port number, note the space before colons)

run vnc viewer

Next you need to connect to the vnc server on ifarm1401 by a vnc viwer

The simple way is to use vncviewer on ifarm to test see if your vncserver runs ok. It's slow if your machine is not at jlab network

ssh -XY your_lab_username@ifarm1401 (login with Xwindow forwarding enabled)
vncviewer localhost:port            (replace port with correct vnc server port number)

The best way is run vncviewer on your machine anywhere through ssh tunneling

for linux, run "yum install tigervnc" to install vncviewer
for windows, download putty and https://www.realvnc.com/en/connect/download/viewer/ vncviewer]
built ssh tunnel with port number of vnc server as follows
  "ssh -X -N -g -L 5999:localhost:port your_lab_username@ifarm1401.jlab.org" if your linux machine is at jlab
  "ssh -X -N -g -L 5922:ifarm1401:22 your_lab_username@login.jlab.org" and "ssh -X -N -g -L 5999:localhost:port your_lab_username@login.jlab.org" if your linux machine is at jlab
vncviewer localhost:99