From charlesreid1

No edit summary
Line 12: Line 12:


== Configuration ==
== Configuration ==


=== Trilinos 10.x (CMake) ===
=== Trilinos 10.x (CMake) ===


To build with CMake, you should create a build directory, and put a run_cmake.sh script in your build directory.  This script will contain the CMake directives.   
To build with CMake, you should create a build directory, and put a <code>run_cmake.sh</code> script in your build directory.  This script will contain the CMake directives.  Alternatively, you can use <code>ccmake</code>, which is a sort-of command-line GUI interface to CMake.
 
My recommendation for directory creation/setup is the following:
 
<pre>
/path/to/trilinos-build/ --> this is where you run CMake from
/path/to/trilinos-build/src --> this is where you put your Trilinos source code
</pre>
 
Using a <code>run_cmake.sh</code> script:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#!/bin/sh
#!/bin/sh
#
# ./run_cmake.sh
# make
# make install
#
# see http://trilinos.sandia.gov/Trilinos10CMakeQuickstart.txt for a lot more information
cmake \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
/path/to/trilinos-10.x/src
</syntaxhighlight>
This will enable all the stable packages.  If you're just looking to use one or two, and you don't want to sit there and wait for hours for it to compile, then you can just use:


<syntaxhighlight lang="bash">
-D Trilinos_ENABLE_<PACKAGE>:BOOL=ON
</syntaxhighlight>
</syntaxhighlight>
to enable a few packages, instead of enabling all the packages.
If you don't want to run into compiler hassles, you'll want to use a version of <code>gcc</code>, <code>g++</code>, and <code>gfortran</code> that are all the same.  On a Mac, this is a little tricky.  I use [[Fink]] to install the GNU compiler collection, so the versions all match, and then add these flags to the <code>run_cmake.sh</code> script:
<syntaxhighlight lang="bash">
CC=/sw/bin/gcc-4 \
CXX=/sw/bin/g++-4 \
F77=/sw/bin/gfortran \
</syntaxhighlight>




Line 42: Line 82:
   --prefix=/path/to/trilinos \
   --prefix=/path/to/trilinos \
   --disable-default-packages \
   --disable-default-packages \
  --enable-aztecoo \
  MACOSX_DEPLOYMENT_TARGET=10.5 \
</syntaxhighlight>
</syntaxhighlight>


This will only install the package <code>aztecoo</code>, but there are a plethora of others to install (see http://trilinos.sandia.gov/packages/ for the full list).
There are a plethora of packages to install using <code>--enable-packagename</code> (see http://trilinos.sandia.gov/packages/ for the full list). Also, if you're building on Mac OS X 10.5 (Leopard), you may need to add this environmental variable to your configure line:
 
<syntaxhighlight lang="bash">
MACOSX_DEPLOYMENT_TARGET=10.5 \
</syntaxhighlight>

Revision as of 06:24, 13 October 2010

Trilinos is a suite of object-oriented C++ libraries designed to help facilitate multiphysics simulations. It consists of a whole bunch of different packages, each with its own problem-focus and its own capabilities.

http://trilinos.sandia.gov/

Installation

Dependencies

If you're installing Trilinos 10.x, you'll need to install CMake, a build system with some similarities to, and many differences from, GNU autotools. See the Presentations page - the "Software" Scientific Computing Summer Workshop covers CMake, as well as differences in the build process between CMake and GNU autotools. (GNU autotools require the usual "configure, make, make install" sequence.)


Configuration

Trilinos 10.x (CMake)

To build with CMake, you should create a build directory, and put a run_cmake.sh script in your build directory. This script will contain the CMake directives. Alternatively, you can use ccmake, which is a sort-of command-line GUI interface to CMake.

My recommendation for directory creation/setup is the following:

/path/to/trilinos-build/ --> this is where you run CMake from
/path/to/trilinos-build/src --> this is where you put your Trilinos source code

Using a run_cmake.sh script:

#!/bin/sh
#
# ./run_cmake.sh
# make
# make install
#
# see http://trilinos.sandia.gov/Trilinos10CMakeQuickstart.txt for a lot more information

cmake \
 -D CMAKE_BUILD_TYPE:STRING=DEBUG \
 -D Trilinos_ENABLE_ALL_PACKAGES:BOOL=ON \
 -D Trilinos_ENABLE_TESTS:BOOL=ON \
 /path/to/trilinos-10.x/src

This will enable all the stable packages. If you're just looking to use one or two, and you don't want to sit there and wait for hours for it to compile, then you can just use:

-D Trilinos_ENABLE_<PACKAGE>:BOOL=ON

to enable a few packages, instead of enabling all the packages.

If you don't want to run into compiler hassles, you'll want to use a version of gcc, g++, and gfortran that are all the same. On a Mac, this is a little tricky. I use Fink to install the GNU compiler collection, so the versions all match, and then add these flags to the run_cmake.sh script:

 CC=/sw/bin/gcc-4 \
 CXX=/sw/bin/g++-4 \
 F77=/sw/bin/gfortran \


Trilinos 9.x (Autotools)

Configuring Trilinos is a pain if you haven't done it before, because you have to have a version of gcc, g++, and gfortran with matching version numbers - but it won't tell you that.

On a Mac, there's no stock gfortran, and if you can find one, it usually doesn't match the GNU C/C++ compiler versions. So, I use Fink to install the entire GNU compiler collection, so that everything is the same version. I can point Trilinos' configure to the compilers to use with the following configure line:

#!/bin/sh
#
# run configure
# make 
# make install

./configure \
  CC=/sw/bin/gcc-4     \
  CXX=/sw/bin/g++-4    \
  F77=/sw/bin/gfortran \
  --prefix=/path/to/trilinos \
  --disable-default-packages \

There are a plethora of packages to install using --enable-packagename (see http://trilinos.sandia.gov/packages/ for the full list). Also, if you're building on Mac OS X 10.5 (Leopard), you may need to add this environmental variable to your configure line:

MACOSX_DEPLOYMENT_TARGET=10.5 \