ParaView/ParaView And Mesa 3D

From KitwarePublic
< ParaView
Revision as of 14:50, 12 October 2011 by Utkarsh (Talk | contribs)

Jump to: navigation, search

ParaView requires OpenGL libraries for rendering. For machines with sophisticated graphics cards, the OpenGL libraries are typically provided by the device drivers for those cards. However, on certain machines such as supercomputers without specialized graphics hardware, one has to rely on software-based rendering alternatives such as Mesa. Mesa is an open-source implementation of the OpenGL specification.

Mesa can be configured to work within different environments ranging from software emulation to complete hardware acceleration when supported GPUs are present. This discussion only applies to Mesa with software emulation on linux-based systems.

When to use Mesa

Some of the use-cases when one would build ParaView with Mesa are:

  1. You are building on a machine where X Window System is not available.
  2. 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 --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.