ParaView/ParaView And Mesa 3D tmp
I'm updating this page and will replace the original and remove this page when finished.--Burlen 16:11, 17 November 2013 (EST)
Read this first
ParaView and VTK make use of OpenGL for rendering. Most operating systems provide a default OpenGL library. If you're running a Windows or Mac OSX operating system, this page is not for you. On Windows download and install the latest drivers for your system's graphics hardware. On Apple Mac OSX just use the default OS provided drivers. On Linux the default OpenGL drivers are typically provided by Mesa. Mesa is an open source OpenGL implementation that supports a wide range of graphics hardware each with it's own back-end called a renderer. Mesa also provides several software based renderers for use on systems without graphics hardware. If you're running a Linux OS on a system without graphics hardware then this page is for you.
Mesa for your GPU
Before getting into details of Mesa graphics hardware drivers, a disclaimer. If you have graphics hardware Mesa is not your best option. To get the best performance from your graphics card you'll need to install the vendor provided driver. Vendor provided OpenGL drivers are typically much faster of a much higher quality than Mesa's which can be quite buggy. Many distros now provide thridparty non-opensource source drivers through specialized package repositories. The details of installing vendor provided drivers in beyond the scope of this document. Please consult distro and/or vendor specific documentation.
If you're running a Linux OS with X11 and graphics hardware and have not installed any OpenGL libraries you're probably already using Mesa! Note that the windowing system, in this case X11, is required for on-screen interactive rendering. On Linux systems the easiest way to install Mesa is through your distro's package manager. Most distros also provide packages for Mesa's software based renderers as well. Unfortunately, some OpenGL features may be disabled by your distro's package maintainers to avoid patent or other licensing restrictions. If you find that this is the case then you'll likely want to build Mesa from source. Given the depth and breadth of the universe of hardware that Mesa supports, building Mesa for use on systems with graphics hardware is beyond the scope of this article. Please consult the Mesa documentation directly.
OSMesa, Mesa without graphics hardware
On Unix/Linux systems lacking graphics hardware one of Mesa's OSMesa, a collection of off screen renderers, can provide OpenGL. Here we will discus two of OSMesa's renderers: Gallium llvmpipe and classic. Mesa's Gallium llvmpipe renderer is one of the exciting recent developments in Mesa. It is a threaded software based OpenGL 3.0 compliant renderer which uses LLVM and clang for JIT compilation of GLSL shaders. Gallium llvmpipe support for OSMesa was added in the 2013 9.2.0 release. It's currently the best software based OpenGL option, in terms of both OpenGL features and performance, for ParaView and VTK. OSMesa classic, the legacy implementation may still be useful in the case of a bug in the llvmpipe renderer and provides a stable fallback.
OSMesa Gallium llvmpipe state-tracker
Classic OSMesa
./configure CXXFLAGS=-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31 CFLAGS=-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31 --disable-xvmc --disable-glx --disable-dri --with-dri-drivers= --with-gallium-drivers= --enable-texture-float --disable-shared-glapi --disable-egl --with-egl-platforms= --enable-osmesa --enable-gallium-llvm=no --prefix=/work/apps/mesa/9.2.2/classic
OSMesa vs. GPU Performance
The following chart shows the run time of VTK's Rendering ctests with OSMesa classic, Gallium llvmpipe OSMesa state-tracker, and an ATI Radeon HD 7870. The CPU on the test sytsem is a 4 core(8 thread) Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz. The ATI driver used is AMD Catalyst 13.11-beta6. Run times were obtained by running each ctest twice consecutively discarding the first time. Tests that took less than 1 second were discarded, as were tests that failed on any one of the renderers. Note results are reported in cases where Classic OSMesa doesn't provide all the extensions, but Gallium llvmpipe does. For example classic OSMesa doesn't provide render buffer float. In these cases the run time reported for the classic OSMesa is ~0.
The results show that Gallium llvmpipe OSMesa state tracker is quite a bit better across the board and supports more rendering algorithms than OSMesa classic. This especially so for GPU accelerated volume rendering.
When to use Mesa
Some of the use-cases when one would build ParaView with Mesa are:
- You are building on a machine where X Window System is not available.
- You are building on a machine that has X, but you does not have graphics hardware or you still want to use software emulation for various reasons.
In case of (1) you'll have to build with OSMesa support. With newer versions of Mesa (>= 7.9), ParaView can be built with OSMesa only when the Qt GUI is disabled. Refer to #ParaView with Offscreen Mesa
In case of (2) you can configure Mesa with X support. Unlike with OSMesa, in this configuration, one can build both the server-executables as well as the Qt client, and both will use Mesa for rendering. Refer to #ParaView with Mesa.
ParaView with Mesa
This section describes the compilation process for machines with X. With newer versions of Mesa (>= 7.9) it is NOT possible to build with OSMesa support as well.
Configuring Mesa
Download Mesa libraries from Mesa3D website. For ParaView, only MesaLib package is required.
Configure and build Mesa based as described on Mesa3D website.
The recommended steps are:
./configure --with-driver=xlib --enable-osmesa --prefix={MESA_INSTALL_PREFIX} make make install
Configuring ParaView
Configure ParaView as described on ParaView:Build And Install. The only cmake variables that need to be updated are:
OPENGL_INCLUDE_DIR = {MESA_INSTALL_PREFIX}/include OPENGL_gl_LIBRARY = {MESA_INSTALL_PREFIX}/lib/libGL.[so|a] OPENGL_glu_LIBRARY = {MESA_INSTALL_PREFIX}/lib/libGLU.[so|a]
- IF AND ONLY IF* Mesa version < 7.9, one can also set the following cmake variables and build ParaView with OSMesa support. In this case, pvserver --use-offscreen-rendering will use OSMesa.
VTK_OPENGL_HAS_OSMESA = ON OSMESA_INCLUDE_DIR = {MESA_INSTALL_PREFIX}/include OSMESA_LIBRARY = {MESA_INSTALL_PREFIX}/lib/libOSMesa.[so|a]
The rest on the configure and build process for ParaView remains as described on ParaView:Build And Install.
ParaView with Offscreen Mesa
If you Mesa version < 7.9, simply follow the instructions described in the previous section. However, if you have Mesa version >=7.9, it's not possible to build ParaView with onscreen and offscreen Mesa support at the same time. Without onscreen support, one cannot build the Qt application. So if you need the Qt application as well server executables with offscreen support, you'll have to do two separate builds when using Mesa version >=7.9.
The following discussion only applies to Mesa >= 7.9 (although it should work with older versions too).
Configuring Mesa
Download Mesa libraries from Mesa3D website. For ParaView, only MesaLib package is required.
Configure and build Mesa based as described on Mesa3D website.
The recommended steps are:
./configure --with-driver=xlib --prefix={MESA_INSTALL_PREFIX} make make install
Alternatively, one can use the following configure line. The only difference is that it does not build a libGL.[so|a] file. This keeps us from accidentally linking with that library which can result in segfaults when running ParaView.
./configure --with-driver=osmesa --prefix={MESA_INSTALL_PREFIX} make make install
Configuring ParaView
Configure ParaView as described on ParaView:Build And Install. The only cmake variables that need to be updated are:
PARAVIEW_BUILD_QT_GUI = OFF OPENGL_INCLUDE_DIR = {MESA_INSTALL_PREFIX}/include OPENGL_gl_LIBRARY = <empty> -- ENSURE THAT THIS IS EMPTY. OPENGL_glu_LIBRARY = {MESA_INSTALL_PREFIX}/lib/libGLU.[so|a] VTK_OPENGL_HAS_OSMESA = ON OSMESA_INCLUDE_DIR = {MESA_INSTALL_PREFIX}/include OSMESA_LIBRARY = {MESA_INSTALL_PREFIX}/lib/libOSMesa.[so|a] VTK_USE_X = OFF
Some of these CMake variables don't show up until a few configure steps and it can be tricky to change their values afterwords. So when running cmake for the first time, one can use the following command:
ccmake -D PARAVIEW_BUILD_QT_GUI:BOOL=OFF -D VTK_USE_X:BOOL=OFF -D VTK_OPENGL_HAS_OSMESA:BOOL=ON {PARAVIEW_SOURCE_DIR}
The rest on the configure and build process for ParaView remains as described on ParaView:Build And Install.