<html>
<head>
<title>The deal.II Readme on interfacing to PETSc and Trilinos</title>
- <link href="screen.css" rel="StyleSheet">
+ <link href="../screen.css" rel="StyleSheet">
<meta name="author" content="the deal.II authors <authors @ dealii.org>">
<meta name="copyright" content="Copyright (C) 2008, 2009, 2010, 2011, 2012 by the deal.II authors">
<meta name="date" content="$Date$">
<body>
-
<h1>Interfacing <acronym>deal.II</acronym> to PETSc and Trilinos</h1>
<h3>About PETSc, Trilinos, and the <acronym>deal.II</acronym>
interfaces</h3>
<p>
- <acronym>deal.II</acronym> can interface to the <a
- href="http://www.mcs.anl.gov/petsc/" target="_top">PETSc</a> and
+ <acronym>deal.II</acronym> can interface to the
+ <a href="http://www.mcs.anl.gov/petsc/" target="_top">PETSc</a> and
<a href="http://trilinos.sandia.gov" target="_top">Trilinos</a> software
libraries. Both of these libraries provide lots of functions for linear
algebra, among other things, for example implementations of a variety of
</p>
<p>
- Alternatively, the <code>--with-petsc=DIR</code> and
- <code>--with-petsc-arch=ARCH</code> switches to
- <code>./configure</code> can be used to override the values
- of <code>PETSC_DIR</code> and <code>PETSC_ARCH</code> or if
- these environment variables are not set at all. If you do have a
- PETSc installation and have set the <code>PETSC_DIR</code> and
+ Alternatively, the <code>-DPETSC_DIR=DIR</code> and
+ <code>-DPETSC_ARCH=ARCH</code> options for <code>cmake</code>
+ can be used to override the values of <code>PETSC_DIR</code>
+ and <code>PETSC_ARCH</code> or if these environment
+ variables are not set at all. If you do have a PETSc
+ installation and have set the <code>PETSC_DIR</code> and
<code>PETSC_ARCH</code> environment variables but do not wish
<acronym>deal.II</acronym> to be configured for PETSc use, you
- should specify <code>--with-petsc=no</code> as a flag during
- configuration.
+ should specify <code>-DDEAL_II_WITH_PETSC=OFF</code> as a flag
+ during configuration.
</p>
<p>
compiled in its usual mode supporting multithreading. If you see
this sort of behavior, we recommend to try disabling
multithreading upon configuration of <acronym>deal.II</acronym>
- using the
- <code>--disable-threads</code> switch to <code>./configure</code>.
+ using the <code>-DDEAL_II_WITH_THREADS=OFF</code> switch for
+ <code>cmake</code>.
</p>
<p>
difficult to understand error messages at compile or link time are
almost inevitable, and there is little the <acronym>deal.II</acronym>
build system can do to prevent this. Thus, <i>don't try to do such a
- thing!</i>
+ thing!</i>
</p>
<p>
As above, set the <code>TRILINOS_DIR</code>
environment variable to the path to an existing Trilinos installation,
- or use the <code>--with-trilinos=/path/to/trilinos</code> switch of
- the deal.II <code>./configure</code> 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
- <acronym>deal.II</acronym> is configured for, i.e. if you want deal.II
- to use shared libraries, then Trilinos needs to use shared libraries as
- well.
+ or use the <code>-DTRILINOS_DIR=/path/to/trilinos</code> switch of
+ the deal.II <code>cmake</code> script. It should point to the path
+ of which the include and lib directories are subdirs.
</p>
<p>
<p>
Trilinos uses <a href="http://cmake.org/">cmake</a> to configure and
- build. This is a bit cumbersome because you have to enter
- the following slightly longish set of commands:
+ build. The following slightly longish set of commands will set up a
+ reasonable configuration:
<code>
<pre>
- cd trilinos-10.4.2
- mkdir build
- cd build
-
- cmake -D Trilinos_ENABLE_OPTIONAL_PACKAGES:BOOL=ON \
- -D Trilinos_ENABLE_Sacado:BOOL=ON \
- -D Trilinos_ENABLE_Stratimikos:BOOL=ON \
- -D CMAKE_BUILD_TYPE:STRING=RELEASE \
- -D CMAKE_CXX_FLAGS:STRING="-g -O3" \
- -D CMAKE_C_FLAGS:STRING="-g -O3" \
- -D CMAKE_FORTRAN_FLAGS:STRING="-g -O5" \
- -D Trilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran" \
- -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
- -D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \
- -D TPL_ENABLE_MPI:BOOL=OFF \
- -D CMAKE_INSTALL_PREFIX:PATH=/w/bangerth/share/x86_64/trilinos-10.4.2 \
- -D BUILD_SHARED_LIBS:BOOL=ON `pwd`/..
-
- make
- make install
+ cd trilinos-10.4.2
+ mkdir build
+ cd build
+
+ cmake -D Trilinos_ENABLE_OPTIONAL_PACKAGES:BOOL=ON \
+ -D Trilinos_ENABLE_Sacado:BOOL=ON \
+ -D Trilinos_ENABLE_Stratimikos:BOOL=ON \
+ -D CMAKE_BUILD_TYPE:STRING=RELEASE \
+ -D CMAKE_CXX_FLAGS:STRING="-g -O3" \
+ -D CMAKE_C_FLAGS:STRING="-g -O3" \
+ -D CMAKE_FORTRAN_FLAGS:STRING="-g -O5" \
+ -D Trilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran" \
+ -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
+ -D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \
+ -D TPL_ENABLE_MPI:BOOL=OFF \
+ -D CMAKE_INSTALL_PREFIX:PATH=/w/bangerth/share/x86_64/trilinos-10.4.2 \
+ -D BUILD_SHARED_LIBS:BOOL=ON ..
+
+ make
+ make install
</pre>
</code>
Again, the path into which you want to install Trilinos in the second to
following flags to the call above:
<code>
<pre>
- -D BLAS_LIBRARY_NAMES:STRING=goto \
- -D BLAS_LIBRARY_DIRS:STRING=/apps/GotoBLAS/lib64 \
- -D LAPACK_LIBRARY_NAMES:STRING=lapack \
- -D LAPACK_LIBRARY_DIRS:STRING=/apps/lapack-3.2.1/lib64
+
+ -D BLAS_LIBRARY_NAMES:STRING=goto \
+ -D BLAS_LIBRARY_DIRS:STRING=/apps/GotoBLAS/lib64 \
+ -D LAPACK_LIBRARY_NAMES:STRING=lapack \
+ -D LAPACK_LIBRARY_DIRS:STRING=/apps/lapack-3.2.1/lib64
</pre>
</code>
</p>
- <p>
- If the deal configuration complains about
- <code><pre>
- configure: error: *** Your Trilinos installation is not compatible with the C++ standard selected for this compiler. See the deal.II FAQ page for a solution. ***
- </pre></code>
- you have encountered a bug in Trilinos. As a workaround,
- include/Sacado_cmath.hpp has to be edited (see <a href="http://dealii.sourceforge.net/index.php?title=Deal.II_Questions_and_Answers#Trilinos_detection_in_..2Fconfigure_fails_with_an_error_in_the_file_Sacado.hpp_or_Sacado_cmath.hpp">the FAQ entry for details</a>).
- </p>
-
-
<h3>Configuring for installed Trilinos packages</h3>
<p>
- 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 <code>--with-trilinos</code>. This scheme doesn't work,
- however, if Trilinos has been installed as a regular package on a
- system, for example into the <code>/usr</code> or <code>/opt</code>
- directories.
- </p>
-
- <p>
- In that case, paths to include and library files may be specified
- separately using the <code>--with-trilinos-include</code>
- and <code>--with-trilinos-libs</code> switches
- to <code>./configure</code>. Alternatively, this information can also
- be passed to the configuration script by setting the environment
- variables <code>TRILINOS_INCDIR, TRILINOS_LIBDIR</code>.
- </p>
+ A system wide installation Support for Trilinos will be enabled
+ automatically if a system wide installation of Trilinos can
+ be found. If the Trilinos installation does not reside under a
+ default system location provide TRILINOS_DIR in the same fashion as
+ for the self compiled case:
+ <pre>
- <h3>Dealing with other Trilinos packages</h3>
-
- <p>
- In the commands configuring Trilinos shown above, we have assumed a
- particular subset of Trilinos libraries that deal.II interfaces
- with. However, Trilinos has many more packages that deal.II doesn't
- use, and you can add many more <code>-D
- Trilinos_ENABLE_XXX:BOOL=ON</code> flags for
- package <code>XXX</code>. Most of the time, no harm is done by doing
- so, but there are cases where some of the packages deal.II does
- interact with also interacts with package <code>XXX</code> if the
- latter was enabled in Trilinos. One example is that Trilinos' ML
- package (which we use) uses Trilinos' Zoltan package if Zoltan is
- enable, but not if Zoltan is not enabled. That means that
- the <code>libml.so</code> library may or may not depend on
- a <code>libzoltan.so</code> library.
+ -DTRILINOS_DIR=/path/to/trilinos
+ </pre>
</p>
- <p>
- Unfortunately, Trilinos' configuration framework does not record this
- in <code>libml.so</code>, and it is also something that is difficult
- for the deal.II configuration framework to find out after the
- fact. Consequently, deal.II's Makefiles rely on the fact
- that <i>only</i> the Trilinos packages listed above were enabled. If
- that isn't the case, you may get linker warnings. The only way to
- solve this problem is to add the additional Trilinos libraries at the
- appropriate place in the list of <code>DEAL_II_TRILINOS_LIBS</code>
- libraries in <code>common/Make.global_options</code> by hand.
- </p>
<hr>
<address>