User:Egm6936.s11/FENICS/Installation

= Through Ubuntu's Package Manager =


 * Through the software manager, install fenics software packages. This documentation is written against version 11.05-2.  For more information see the fenics installation manual


 * Install python (v3.2 as of Jun 2011), so that the python tutorials/code may be used.

This completes the installation.

= By source =


 * Compiling from source: http://fenicsproject.org/download/installation_from_source.html.
 * Obtaining the code: http://fenicsproject.org/contributing/obtaining_code.html
 * The different components: http://fenicsproject.org/support/launchpad_pages.html#launchpad-pages
 * Third party packages which are needed (and not necessarily in a package manager)
 * Matrix Template Library 4 (MTL4): http://www.simunova.com/de/node/24
 * PaStiX: https://gforge.inria.fr/projects/pastix/
 * Lex and Yacc: http://stackoverflow.com/questions/3871425/how-to-install-lex-and-yacc-in-ubuntu
 * Scotch: https://gforge.inria.fr/projects/scotch/
 * hwloc: http://www.open-mpi.org/projects/hwloc/

To compile dolfin I created a sub directory (dolfin) and used cmake-gui to find all the optional dependencies. After selecting configure, some values were not found (such as boost, trilinos locations). Simply update the values and generate (configuring again 'starts over').

Another option, which I had more success with was to install using the ./cmake.local script. The paths to specific dependencies which I built from source had to be provided. I built SLEPc, PETSc, VTK, Trilinos from source, which required some customization to cmake.local.

I updated cmake.local as follows to pass certain paths to cmake (and not make)

Source control
The fenics project utilizes Bazaar for source control. See: http://bazaar.canonical.com/en/

Ten reasons to use Bazaar why switch to bazaar


 * 1) Version control for everyone
 * 2) Work offline
 * 3) Any workflow
 * 4) Cross platform support
 * 5) Rename tracking and smart merging
 * 6) High storage efficiency and speed
 * 7) Any workspace model
 * 8) Plays well with others
 * 9) Launchpad
 * 10) Plugins and bzrlib

Overall Bazaar is okay. It is nice how you can have a local repository setup easily. Setting up a server looked a bit involved on windows and I avoided it.

Trilinos
The version of Trilinos in Ubuntu's 12.04 package manager is still at 10.4, and has a customization to workaround a build issue with gcc 4.6. The customization changes the Trilinos interface which prevents dolfin from building against Trilinos.

"The Ubuntu Trilinos package is old (10.4). It is a modified version, because the 10.4 source fails to compile with gcc 4.6.

There is a nasty change in the Epetra interface - the old code still compiled, but thanks to an interface change the code did something different.

I would prefer to support just the latest (10.8). Is there demand for 10.4? I wouldn't advocate using any of the Ubuntu/Debian linear algebra packages (Trilinos/PETSc/BLAS) for performance."

- Garth N. Wells, Anders Logg, Johannes Ring

The package is optional, and can be simply left out of the build. The following was found helpful when looking into building Trilinos http://amiatypist.blogspot.com/2010/05/relocation-truncated-to-fit-rx866432s.html, and http://slug.blog.aeminium.org/2011/07/16/trilinos-10-6-x-ubuntu-11-04/.

To build in Ubuntu 12.04 I updated the script provided above. Note, I left SuperLU out of the build due to compilation errors mentioned above. Specifically the compiled superlu shared library would not link with Trilinos.

Script (create as a shell script)

To compile and install,

PETSC
PETSC can be found here with instructions on compiling and installing.

http://www.mcs.anl.gov/petsc/developers/index.html

The developers have mentioned the performance of PETSC in the Ubuntu packages are poor - building a later version is highly recommended.

I used version 3.3 patch 2.

Note, to install a prefix is needed (where to install).

SLEPC
SLEPC can be found here with instructions on compiling and installing.

http://www.grycap.upv.es/slepc/

SLEPC installs very much like PETSC.

I used version 3.3 patch 2.

SLEPC uses the PETSC configuration (detected on configure). Sudo is needed to gain access to the PETSC prefix install.

Note that I had to create a sybolic linke from /usr/lib/libslepc.so to /usr/lib/lib/libslepc.so

VTK
VTK was not as easy to install. VTK can be found here

http://www.vtk.org/VTK/resources/software.html

Note the instructions are in a README.htm file within the tarball.

I used version 5.10.0, which did resolve some serious segfaults within virtual box when compared to VTK in Ubuntu's package manager. Installing the latest version was necessary in my case. The bug is likely due to a very recent version of dolfin against an older VTK version that shipped with Ubuntu.

Configuration
Configuration is initiated by calling cmake on the VTK source directory. There is an interactive configuration (cmake-gui) that allows the user to edit configuration variables.

CMAKE_INSTALL_PREFIX /usr/lib

Be sure to enable the python wrappers and desired features.

This was very important for my build: In advanced mode, set VTK_PYTHON_SETUP_ARGS to  --prefix=/usr

I generally enabled most of the features visible in 'simple mode'

Once configured, configure by pressing 'c'. Then generate the build files by pressing 'g'.

Compiling
I tried to compile here with sudo make install, but hit an error saying /usr/bin/python2.7/site-packages/ does not exist.

Oddly, there is a /usr/bin/python2.7/dist-packages/ in the directory. I spent some time looking into how to install into dist-packages and finally found an explanation for the two directoriesdist-packages and site-packages.

"dist-packages is a Debian-specific convention that is also present in its derivatives, like Ubuntu. Modules are installed to dist-packages when they come from the Debian package manager. All other modules are installed into site-packages like normal, e.g. when installed via easy_install or pip.

From the Debian Python Wiki:

dist-packages instead of site-packages. Third party Python software installed from Debian packages goes into dist-packages, not site-packages. This is to reduce conflict between the system Python, and any from-source Python build you might install manually."

- jterrace

Fortunately we can just create the site-packages directory and compile into it.

libvtk shared libraries
To handle a libvtk library configuration issue (see next section), comment out the following in /dolfin-src/dolfin/CMakeLists.txt. This will prevent the linker from looking in the wrong directory.

Copy shared libraries solution (didn't work well)
There is a cmake configuration error in VTK python at some point. In short, when compiling dolfin, the compiler will expect VTK shared libraries in /usr/lib, while they are in /usr/lib/vtk-5.10/. Rather than fixing the pathing - which turned into a rabbit hole - copy the needed shared libraries to /usr/lib. The code will compile and the libraries will by dynamically linked to the correct shared libraries at run time.

For more on this consider this bug report: http://lists.opensuse.org/archive/opensuse-bugs/2011-12/msg00132.html

"--- Comment #1 from Marc Schütz  2011-12-01 16:49:06 UTC --- Additional information on how to reproduce:

I encountered this problem when I tried to compile the Point Cloud Library (PCL) from http://pointclouds.org/.

The build aborts with the following error message: make[2]: *** No rule to make target `/usr/lib/vtk/libvtkCommon.so.5.8.0', needed by `visualization/libpcl_visualization.so.1.2.0'. Stop.

I'm no longer sure now that the problem is only with VTK. Even if I change VTK_LIBRARY_DIRS in /usr/lib/vtk/VTKConfig.cmake, the PCL still tries to look for the libraries in /usr/lib/vtk. Don't know where it gets the path from. The only workaround I found was to symlink the VTK libs to /usr/lib/vtk."

- Marc Schutz

And the following bug report: http://web.archiveorange.com/archive/v/wmeLDjm3PraZDG1aM64x

"-The VTK_LIBRARY_DIRS variable in /usr/lib/vtk/VTKConfig.cmake is set to "${VTK_INSTALL_PREFIX}/lib/vtk" (/usr/lib/vtk), but the RPM doesn't install the libraries into this directory, but into /usr/lib/ instead.

This means, that projects using cmake don't build because they can't find the VTK libraries."

- Marc Schutz

= Nightly Snapshots =

Nightly snapshots can be found here. Note the PPA is a very up to date Debian package - but you will be missing out on the source.

http://fenicsproject.org/download/snapshot_releases.html#snapshot-releases

= Binary Packages =

Binary packages can be found here

http://fenicsproject.org/download/

= Automated installation using Dorsal =

Dorsal is a script which will download and compile FEniCS and all of its dependencies:

http://fenicsproject.org/download/installation_using_dorsal.html#installation-using-dorsal