\chapter{Trilinos}
\label{app:trilinos}

In order to solve PDEs with complex coefficients, escript needs to be compiled with \texttt{Trilinos} support.
This requires that your version of Trilinos has certain features enabled.
Since some precompiled distributions of \texttt{Trilinos} are not built with these features, you may 
need to compile \texttt{Trilinos} yourself as well.

While we can't provide support for building \texttt{Trilinos}, we do list below, a configuration file which seems to work for 
under Debian 9 ``stretch''\footnote{At time of writing, \texttt{stretch} is still in testing, but is due to release this month}.

\section{Debian ``stretch'' configuration}


\subsection{Required packages}

The following packages should be installed to attempt this build:
\begin{itemize}
\item[] cmake
\item[] g++
\item[] libsuitesparse-dev
\item[] libmumps-dev
\item[] libboost-dev
\item[] libparmetis-dev
\item[] libmetis-dev
\item[] libcppunit-dev
\end{itemize}



\subsection{Configuration file}

\begin{verbatim}
#!/bin/sh
# SuperLu has build issues and escript doesn't _need_ it.
DIR=build_hybrid
ROOT=`pwd`
mkdir -p $DIR || exit 1
cd $DIR
cmake -D CMAKE_CXX_COMPILER=`which mpic++` \
      -D CMAKE_C_COMPILER=`which mpicc` \
      -D CMAKE_Fortran_COMPILER=`which mpif77` \
      -D CMAKE_INSTALL_PREFIX=/opt/trilinos/ \
      -D BUILD_SHARED_LIBS=ON \
      -D TPL_ENABLE_BLAS=ON \
      -D TPL_ENABLE_Boost=ON \
      -D TPL_ENABLE_Cholmod=ON \
      -D TPL_ENABLE_CppUnit=ON \
      -D TPL_ENABLE_LAPACK=ON \
      -D TPL_ENABLE_METIS=ON \
      -D TPL_ENABLE_MPI=ON \
      -D TPL_ENABLE_MUMPS=ON \
      -D TPL_ENABLE_ParMETIS=ON \
      -D TPL_ENABLE_Pthread=OFF \
      -D TPL_ENABLE_SCALAPACK=ON \
      -D TPL_ENABLE_Scotch=OFF \
      -D TPL_ENABLE_SuperLU=OFF \
      -D TPL_ENABLE_UMFPACK=ON \
      -D TPL_BLAS_INCLUDE_DIRS=/usr/include/suitesparse \
      -D TPL_Cholmod_INCLUDE_DIRS=/usr/include/suitesparse \
      -D TPL_Cholmod_LIBRARIES='/usr/lib/x86_64-linux-gnu/libcholmod.so;\
/usr/lib/x86_64-linux-gnu/libamd.so;/usr/lib/x86_64-linux-gnu/libcolamd.so' \
      -D TPL_SuperLU_INCLUDE_DIRS=/usr/include/superlu \
      -D TPL_UMFPACK_INCLUDE_DIRS=/usr/include/suitesparse \
      -D TPL_SCALAPACK_LIBRARIES=/usr/lib/libscalapack-openmpi.so \
      -D Trilinos_ENABLE_Amesos2=ON \
      -D Trilinos_ENABLE_Belos=ON \
      -D Trilinos_ENABLE_Ifpack2=ON \
      -D Trilinos_ENABLE_Kokkos=ON \
      -D Trilinos_ENABLE_MueLu=ON \
      -D Trilinos_ENABLE_OpenMP=ON \
      -D Trilinos_ENABLE_Teuchos=ON \
      -D Trilinos_ENABLE_Tpetra=ON \
      -D Trilinos_ENABLE_AztecOO=OFF \
      -D Trilinos_ENABLE_Galeri=OFF \
      -D Trilinos_ENABLE_Ifpack=OFF \
      -D Trilinos_ENABLE_Isorropia=OFF \
      -D Trilinos_ENABLE_ML=OFF \
      -D Trilinos_ENABLE_Thyra=OFF \
      -D Trilinos_ENABLE_Zoltan=ON \
      -D Trilinos_ENABLE_Zoltan2=ON \
      -D Trilinos_ENABLE_EXPLICIT_INSTANTIATION=ON \
      -D Tpetra_INST_COMPLEX_DOUBLE=ON \
      -D Tpetra_INST_INT_LONG=OFF \
      -D Tpetra_INST_LONG_LONG=OFF \
      -D Tpetra_INST_INT_LONG_LONG=OFF \
      -D TpetraKernels_ENABLE_Experimental=ON \
      -D Amesos_ENABLE_EpetraExt=OFF \
      -D Amesos2_ENABLE_MUMPS=ON \
      -D Amesos2_ENABLE_Epetra=OFF \
      -D Amesos2_ENABLE_EpetraExt=OFF \
      -D Belos_ENABLE_Epetra=OFF \
      -D Belos_ENABLE_EpetraExt=OFF \
      -D MueLu_ENABLE_Amesos=OFF \
      -D MueLu_ENABLE_Epetra=OFF \
      -D MueLu_ENABLE_EpetraExt=OFF \
      -D Trilinos_ENABLE_TESTS=OFF \
      -D MueLu_ENABLE_TESTS=OFF \
      $ROOT 2>&1 | tee config.log
\end{verbatim}
