Skip to content

Building a simple example that calls ForTrilinos as a third party library

Andrey Prokopenko edited this page Jun 21, 2018 · 2 revisions

This purpose of this note is to document the (quite straightforward) procedure for building a code that calls ForTrilinos as a third-party library (i.e., it's built outside of the Trilinos build system).

  1. Follow the ForTrilinos build instructions here, defining a CMAKE_INSTALL_PREFIX variable either in the do-configure script or when you call do-configure. Let's call this location TRILINOS_ROOT. Do a make, and make install.
  2. Copy an example from the ForTrilinos tests to whatever directory you want. I picked src/simple/test/test_simple_eigen_handle.f90. Also copy the davidson.xml file.
  3. Modify this example slightly, by replacing the #include "ForTrilinosSimpleInterface_config.hpp" line with #define HAVE_MPI. Also get rid of the use fortest line.
  4. Build the example. I did all this on a LANL HPC machine, so I used the following modules for building both ForTrilinos and the example: intel/17.0.4 and openmpi/2.1.2. The build line was then mpif90 -cpp -I$TRILINOS_ROOT/include -L$TRILINOS_ROOT/lib -lfortrilinos -lfortpetra -lforteuchos -lfor error -Wl,-rpath,$TRILINOS_ROOT/lib example.f90
  5. You should then be able to run the example with mpirun -n 1 a.out.