VirtualGL

Using GiD on a remote server, for instance attached to a cluster, through LAN can be very slow. The X11/GLX protocol causes a heavy traffic of drawing primitives when a huge model is rendered and the local graphics capabilities are used.

This traffic can be lowered by disabling the use of the local graphics card by using GiD in X11 mode, by using the command gidx, which uses software OpenGL provided by Mesa3D. As all the 3D rendering is done by the Mesa3D in the server’s CPU, the visualization of big models can still be painfully slow.

Using the open source package VirtualGL, the server’s graphics capabilities are used to accelerate GiD’s 3D rendering of these big models, improving greatly the user’s experience.

Here are the steps followed to install VirtualGL and use GiD on a visualization’s node,fisheye.cimne.upc.edu attached to our cluster acuario.cimne.upc.eduat CIMNE.

Contents 1 Server 1.1 requirements 1.2 system 1.3 basics 1.4 libjpeg-turbo 1.5 VirtualGL 1.6 TurboVNC 1.7 Configuring VirtualGL server 2 Clients 2.1 Using VirtualGL server 2.1.1 direct connection: Linux clients 2.1.2 VNC conection: MS Windows & Linux clients

Server

requirements

to build a VirtualGL and VNC server you will need:

  • and actualized versions of autoconf, automake, libtool,
  • and, of course, libX11, libXext, libGL, libGLU and libXv development packages

system

fisheye.cimne.upc.edu is an old Sun Ultra 40 M2 Workstation with:

  • 2 AMD Dual-Core Opteron 2214 2.2 GHz
  • 32 GB DDR2-667 of memory
  • Hitachi Deskstar 250Gb hard disk SATA 3Gbps 7200RPM
  • nVidia GeForce GTX 555 1GB graphics card

basics

  • Operating System: Linux Scientific Linux release 6.3
  • Development packages, linux headers, sources, ssh server
  • nVidia drivers: remember
    • add rdblacklist=nouveau to the grub kernel line:
      • by editing the grub configuration at boot time or
      • editing the /boot/grub/grub.conf file and adding it to the kernel … line.
    • reboot
    • ( may be this is not necessary: init 3 # to shut-down graphics session and be back to the text console)
    • install drivers
    • reboot
    • ( may be this is not necessary: init 5 # to be back in the graphics session)

NOTE: Every time the linux kernel is updated or actualized the display driver should be reinstalled. And every time the linux kernel is updated or the display driver actualized the server should be configured again.

libjpeg-turbo

  • Build and install library:
tar -zxvf libjpeg-turbo-1.2.1.tar.gz
cd libjpeg-turbo-1.2.1
./configure
make
sudo make install

will install libjpeg-turbo under /opt/libjpeg-turbo

  • configure system ( as root):
# echo /opt/libjpeg-turbo/lib > /etc/ld.so.conf.d/virtualgl-64.conf
# ldconfig

VirtualGL

  • Build and install library:
tar -zxvf VirtualGL-2.3.2.tar.gz
cd VirtualGL-2.3.2
make unix
cd unix
cmake -G "Unix Makefiles" ..
make

at some point will fail with

[ 15%] Building CXX object server/CMakeFiles/rrfaker.dir/xvtrans.cpp.o
Linking CXX shared library ../lib/librrfaker.so
/usr/bin/ld: /opt/libjpeg-turbo/lib64/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): 
    relocation  R_X86_64_32 against `.data' can not be used when making a shared object; 
    recompile with -fPIC
/opt/libjpeg-turbo/lib64/libturbojpeg.a: could not read symbols: Bad value

to correct this, edit CMakeCache.txt and change all references to libturbojpeg.a tolibturbojpeg.so and:

make
sudo make install

will install VirtualGL under /opt/VirtualGL

  • configure system ( as root): note the >>
# echo /opt/libjpeg-turbo/lib >> /etc/ld.so.conf.d/virtualgl-64.conf
# ldconfig

create /etc/profile.d/virtualgl.sh with:

VIRTUALGL_DIRS="/opt/TurboVNC /opt/libjpeg-turbo /opt/VirtualGL"
for VGLDIR in ${VIRTUALGL_DIRS} ; do
  if ! echo ${PATH} | /bin/grep -q $VGLDIR/bin ; then
     PATH=$VGLDIR/bin:${PATH}
  fi
done
unset VIRTUALGL_DIRS
export PATH

create /etc/profile.d/virtualgl.csh with:

set VIRTUALGL_DIRS = "/opt/TurboVNC /opt/libjpeg-turbo /opt/VirtualGL"
foreach VGLDIR ( $VIRTUALGL_DIRS )
  if ( "${path}" !~ *$VGLDIR/bin* ) then
     set path = ( $VGLDIR/bin $path )
  endif
end
unset VIRTUALGL_DIRS

TurboVNC

  • Build and install library:
tar -zxvf turbovnc-1.1.tar.gz
cd vnc/unix
./configure
make
make xserver
sudo make install
sudo make xserver-install

will install TurboVNC under /opt/TurboVNC

Configuring VirtualGL server

NOTE: Every time the linux kernel is updated or actualized the display driver should be reinstalled. And every time the linux kernel is updated or the display driver actualized this step should be applied again.

Just follow steps described in VirtualGL manual Chapter 6. Here is a view of the step followed to configure fisheye.

The configuration can be done directly on the console or remotely, via ssh.

VirtualGL can restrict the access to 3D acceleration to users belonging to the vglusers group. But at the moment all users who have access to fisheye, who have also access to the cluster, should be able to use the 3D acceleration features. So no restriction to vglusers group.

“x11vnc and x0vncserver both require XTEST, so if you need to attach a VNC server to the 3D X server, then it is necessary to answer “No””

( as root)
# init 3     # to change back to text console, shutting down graphics
( as root)
# /opt/VirtualGL/bin/vglserver_config

1) Configure server for use with VirtualGL
2) Unconfigure server for use with VirtualGL
X) Exit
Choose:
1
Restrict 3D X server access to vglusers group (recommended)? [Y/n]
N
Restrict framebuffer device access to vglusers group (recommended)? [Y/n]
N
Disable XTEST extension (recommended)? [Y/n]
N

1) Configure server for use with VirtualGL
2) Unconfigure server for use with VirtualGL
X) Exit
Choose:
X

After configuration, remember to enable the graphics console:

( as root)
# init 5     # to switch on the graphics on the main console

Now, we can test it:

xdpyinfo -display :0
/opt/VirtualGL/bin/glxinfo -display :0 -c

in the glxinfo output check for an entry like:

    visual  x  bf lv rg d st colorbuffer ax dp st accumbuffer  ms  cav  drw
  id dep cl sp sz l  ci b ro  r  g  b  a bf th cl  r  g  b  a ns b eat  typ
---------------------------------------------------------------------------
0x151  0 tc  0 32  0 r  y  .  8  8  8  0  4 24  8 16 16 16 16  0 0 None PXW

Remember: graphics console should always be on.

Clients

Using VirtualGL server

There are two ways to connect to fisheye.cimne.upc.edu:

  • direct connection, like a ssh +X user@fisheye.cimne.upc.edu
  • using VNC: vncviewer fisheye.cimne.upc.edu:N and a vnc desktop at fisheye

direct connection: Linux clients

On the client computer you’ll need to

  • install the libturbojpeg and VirtualGL packages from your favourite package manager; or
  • download, compile and install libjpeg-turbo, VirtualGL.

Then connect to the VirtualGL server:

$ vglconnect -s YourUsernam@fisheye.cimne.upc.edu
( your password needs to be typed twice)

May be the VirtualGL package is installed in a different directory thant the VirtualGL server. Then you’ll need to pass the server’s directory where VirtualGL is installed:

$ vglconnect -bindir /opt/VirtualGL/bin -s YourUsernam@fisheye.cimne.upc.edu
( your password needs to be typed twice)

Running applications using the server’s graphics card:

# to run a graphic example using the client's graphics
fisheye$ glxspheres
# to run the same graphic example using the servers graphics
fisheye$ vglrun glxspheres
# you can check the graphics:
fisheye$ glxinfo | grep renderer
fisheye$ vglrun glxinfo | grep renderer
# to run GiD there is a shorcut
fisheye$ vglgid           # which is a script launching   vglrun gid

VNC conection: MS Windows & Linux clients

On the client computer you’ll need to install a vnc viewer ( may be available on your favourite package manager):

If you decide to compile and install from source you’ll need libjpeg-turbo and TurboVNC.

Then on the server side you need to:

  • open firewall ports: VNC uses following ports
    • port 5901 for display :1,
    • port 5902 for display :2,
    • port 5903 for display :3,

at least 5901 ( TCP+UDP) should be opened, but enable as many as simultaneous users should be able to connect.

  • start the vnc server if it’s not already started
fisheye$ vncserver 1536x960 :1    # being :1 the first vnc display, can be :2, ...
# the first time you start the vnc server, you'll be asked for a new password which is used to validate vnc connections

remember that VNC password are not the same as your user password in the server. Once the server is started you can let it running and connect at any time you need. But if the system is rebooted, the vncserver needs to be relaunched. May be after a reboot it is necessary to execute ‘vncserver -kill :1` to clean some lock files before restarting the server again.

Then on the client side you can connect to the VNC desktop using

localhost$ vncviewer fisheye.cimne.upc.edu:1
# the VNC password will be asked and then a window with the remote desktop will appear.

To run programs using VirtualGL’s acceleration applications should be started with vglrun:

# to run a graphic example using the client's graphics
fisheye$ glxspheres
# to run the same graphic example using the servers graphics
fisheye$ vglrun glxspheres
# you can check the graphics:
fisheye$ glxinfo | grep renderer
fisheye$ vglrun glxinfo | grep renderer
# to run GiD there is a shorcut
fisheye$ vglgid           # which is a script launching   vglrun gid

Retrieved from “http://gidcvs.cimne.upc.edu/wiki_gid_doc/index.php/GiD_VirtualGL

Scroll to Top