Interfacing deal.II to PETSc and Trilinos

About PETSc, Trilinos, and the deal.II interfaces

deal.II can interface to the PETSc and Trilinos software libraries. Both of these libraries provide lots of functions for linear algebra, among other things, for example implementations of a variety of linear solvers, as well as various different sparse and dense matrix and vector formats. Trilinos also has many subpackages that deal with problems that go far beyond linear algebra, for example nonlinear solvers, automatic differentiation packages, uncertainty propagation engines, etc. Of particular interest to deal.II is their ability to provide this functionality both on sequential and parallel (using MPI) computers. PETSc is written in C; Trilinos is written in C++ and can be considered to be a more modern version of PETSc though both packages are under continuing development at their respective national laboratories.

deal.II has wrapper classes to the linear algebra parts of both packages that provide almost the same interfaces as the built-in deal.II linear algebra classes. We use these interfaces for parallel computations based on MPI since the native deal.II linear algebra classes lack this ability.

Configuring the interfaces to PETSc and Trilinos

The use of PETSc and Trilinos is optional. To use the wrapper classes, you first have to install these packages and point deal.II's ./configure to the installation directories. This happens in similar ways for the two packages:

PETSc

PETSc usually requires you to set the environment variables PETSC_DIR and PETSC_ARCH to a path to PETSc and denoting the architecture for which PETSc is compiled. If these environment variables are set, then deal.II will pick them up during configuration, and store them. It will then also recognize that PETSc shall be used, and enable the wrapper classes.

Alternatively, the --with-petsc=DIR and --with-petsc-arch=ARCH switches to ./configure can be used to override the values of PETSC_DIR and PETSC_ARCH or if these environment variables are not set at all. If you do have a PETSc installation and have set the PETSC_DIR and PETSC_ARCH environment variables but do not wish deal.II to be configured for PETSc use, you should specify --with-petsc=no as a flag during configuration.

Note that in order to use PETSc with deal.II with the current version of deal.II, you need to have at least PETSc version 2.3.1 installed. deal.II version 6.0 has been tested up to PETSc release 2.3.3-p4.

Installing both PETSc and deal.II together can be a bit of a challenge. A good summary of the relevant steps can be found on the Frequently Asked Questions page, as well as in this posting to the mailing list.

Trilinos

As above, set the TRILINOS_DIR environment variable to the path to an existing Trilinos installation, or use the --with-trilinos=/path/to/trilinos switch of the deal.II ./configure script. It should point to the path of which the include and lib directories are subdirs. The Trilinos installation needs to provide the same kind of libraries that deal.II is configured for, i.e. if you want deal.II to use shared libraries, then Trilinos needs to use shared libraries as well.

deal.II and its tutorial programs use several of the Trilinos sub-packages. Configuring Trilinos with a command like the following should do the trick:

../configure --enable-shared \
      --with-cflags=-fPIC --with-cxxflags=-fPIC --with-fflags=-fPIC \
      --enable-thyra --enable-stratimikos --enable-rtop --enable-teuchos \
      --enable-sacado --enable-ml --enable-ifpack --enable-epetra \
      --enable-belos --enable-aztecoo --enable-amesos \
      --prefix=/home/bangerth/bin/trilinos-9.0.1
      

Configuring for installed Trilinos packages

The above scheme works if Trilinos is installed in its own directory and header and library files are in subdirectories of the directory given to --with-trilinos. This scheme doesn't work, however, if Trilinos has been installed as a regular package on a system, for example into the /usr or /opt directories.

In that case, paths to include and library files may be specified separately using the --with-trilinos-include and --with-trilinos-libs switches to ./configure. Alternatively, this information can also be passed to the configuration script by setting the environment variables TRILINOS_INCDIR, TRILINOS_LIBDIR.


The deal.II mailing list $Date: 2008-10-14 05:36:48 -0500 (Tue, 14 Oct 2008) $