Build Trilinos 10.8.x on Ubuntu 11.04 using cmake

This is another learning notes recording what I have done for future reference.

As I tested in a previous post that matrix inversion using Amardillo C++ is no faster than Matlab/Octave, and the benefits of translating Matlab script to C++ code may lie on the potential of paralleling the C++ code. So a straightforward question would be why not translating the m-files with a parallel language or a parallel model in mind, just to save another round of trouble. At least, two libraries exist for this purpose: PETsc and Trinilos. One can translate the matlab scripts under the framework of either library. PETsc has been around since 1999 and was easily installed on ubuntu 11.04, whereas Trilinos started in 2003 and required some knowledge of compiling. I followed this blog which outlined the installation of Trilinos 10.6.x.

Step 1. Install all required math libraries Trilinos needed.

libatlas-base-dev				install
libatlas-dev					install
libatlas-doc					install
libatlas3gf-base				install
libblas-dev					install
libblas-doc					install
libblas3gf					install
liblapack-dev					install
liblapack-doc					install
liblapack3gf					install
libmumps-4.9.2					install
libmumps-dev					install
libmumps-scotch-4.9.2				install
libmumps-scotch-dev				install
libmumps-seq-4.9.2				install
libopenmpi-dev					install
libopenmpi1.3					install
libsuitesparse-dev				install
libsuperlu3					install
libsuperlu3-dev					install
libumfpack5.4.0					install

copy the above content to a file named “math.list” and use this command to install all missing libraries
cat math.list |sudo dpkg –set-selections && sudo apt-get dselect-upgrade

Step 2. I modified the one from Nuno Sucena Almeida

# uncompress trilinos package
~$ tar xf trilinos-10.8.4-Source.tar.gz
# get into source and create build directory
~$ cd trilinos-10.8.4-Source
~/trilinos-10.8.4-Source$ mkdir build && cd build
# copy configure script to build directory and run it
~/trilinos-10.8.4-Source/build$ cp ~/configure-trilinos-ubuntu.sh .
build$ chmod u+x configure-trilinos-ubuntu.sh
build$ ./configure-trilinos-ubuntu.sh
# start build process with 3 cores
build$ make -j3
build$ make install

Here is the content of configure-trilinos-ubuntu.sh:

#!/bin/bash
# (C) 2009-2011 Nuno Sucena Almeida
# (C) 2011 Nov Modified by JunweiHuang.info

# 1. mkdir BUILD && cd BUILD
# 2. rm -f CMakeCache.txt && ./configure-trilinos-ubuntu.sh
# 3. time make -j2 2>&1 |tee build.log

EXTRA_ARGS=$@
TRILINOS_HOME=~/data/trilinos/src/

INSTALL_DIR=~/data/trilinos/10.8.3

#SWIG was build from source, since 10.8.3 trilinos needs SWIG version > 2.0
SWIG_EXECUTABLE=/usr/local/bin/swig

#SUPERLU was not included
UMFPACK_INCLUDE=/usr/include/suitesparse
CMAKE_EXECUTABLE=/usr/bin/cmake

( time ${CMAKE_EXECUTABLE} 
  -D CMAKE_CXX_FLAGS:STRING="-pipe" 
  -D CMAKE_C_FLAGS:STRING="-pipe" 
  -D CMAKE_Fortran_FLAGS:STRING="-pipe" 
  -D CMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} 
  -D PyTrilinos_INSTALL_PREFIX:PATH=${INSTALL_DIR} 
  -D CMAKE_BUILD_TYPE:STRING=DEBUG 
  -D TPL_ENABLE_MPI:BOOL=ON 
  -D TPL_ENABLE_UMFPACK:STRING=ON 
  -D TPL_UMFPACK_INCLUDE_DIRS:STRING=${UMFPACK_INCLUDE} 
  -D TPL_ENABLE_MUMPS:STRING=ON 
  -D BUILD_SHARED_LIBS:STRING=ON 
  -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON 
  -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON 
  -D Trilinos_ENABLE_Didasko:BOOL=ON 
  -D Trilinos_ENABLE_PyTrilinos:BOOL=ON 
  -D Trilinos_ENABLE_TESTS:BOOL=ON 
  -D SWIG_EXECUTABLE:FILEPATH=${SWIG_EXECUTABLE} 
  -D DART_TESTING_TIMEOUT:STRING=600 
  $EXTRA_ARGS 
  ${TRILINOS_HOME} ) 2>&1 |tee log

The end.

4 thoughts on “Build Trilinos 10.8.x on Ubuntu 11.04 using cmake

  1. Thanks a lot for being the lecturer on this area. We enjoyed your own article quite definitely and most of all cherished how you handled the issues I widely known as controversial. You happen to be always quite kind towards readers much like me and help me in my lifestyle. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *