0207 Compilation Trilinos Windows

Kirill Terekhov edited this page Aug 30, 2018 · 4 revisions

Compilation guide for INMOST with Trilinos linear algebra packages on Windows

INMOST may be configured with optional Trilinos support. In this case INMOST will support calling linear solvers from Trilinos package, i.e. you will be able to activate Solver::Trilinos_Aztec, Solver::Trilinos_ML, Solver::Trilinos_Ifpack, Solver::Trilinos_Belos packages in Solver::Solver constructor.

This guide requires you to have CMake and Microsoft Visual Stuido. Tested with Epetra, AztecOO, Ifpack, Belos and ML packages from Trilinos 11.12.1.

In order to compile trilinos linear algebra packages you would need to provide it BLAS and LAPACK.

Go to http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html and download an archive ending with CMAKE. You can try CLAPACK from official site http://www.netlib.org/clapack/ as well, but at the time it had no installation script which is necessery.

Unarchive CLAPACK into "clapack_source_path" and create "clapack_build_path". Open cmake-gui application and enter clapack_source_path into the field to the right from "Where is the source code" text and clapack_build_path into the field to the right from "Where to build the binaries".

pic1

Click "Configure" and select Visual Studio as your compiler, compiler should be the same as was for INMOST and would be for Trilinos.

pic2

Create folder clapack_build_path/install for the place where libraries and headers will be installed later and in CMake click "Add Entry" button and enter:

CMAKE_INSTALL_PREFIX of type PATH with clapack_build_path/install

pic3

Click "Configure" again and then click "Generate". Search for CLAPACK.sln file in clapack_build_path and open it.

pic4

Once Visual Studio is open go to "Build/Configuration Manager".

pic5

And change "Debug" mode to "Release" mode.

pic6

Now hit F7 button to compile CLAPACK library. After successful compilation go to "View/Solution Explorer".

pic7

In "Solution Explorer" right click on "INSTALL" project and click "Build".

pic8

Now you are ready to compile Trilinos.

You can download Trilinos package from http://trilinos.org/download/. Please note that in order to download it you have to provide some basic information about yourself.

After you have downloaded and unarchived Trilinos into "trilinos_source_path" create "trilinos_build_path". Open cmake-gui application and enter trilinos_source_path into the field to the right from "Where is the source code" text and trilinos_build_path into the field to the right from "Where to build the binaries".

Then hit "Configure" button, after some time CMake will provide you all the options that Trilinos offers.

You will need to click "Add Entry" button and add three entries one after another:

CLAPACK_DIR of type PATH and provide path to clapack_build_path/install

TPL_BLAS_LIBRARIES type PATH and provide path to clapack_build_path/install/lib/blas.lib;clapack_build_path/install/lib/libf2c.lib

TPL_LAPACK_LIBRARIES type PATH and provide path to clapack_build_path/install/lib/lapack.lib

pic9

After that if you want to use Trilinos solver in parallel you should enter into search field TPL_ENABLE_MPI and set the checkbox.

If your MPI library cannot be detected automatically by CMake you should also click "Add Entry" button and provide

MPI_INCLUDE_DIR of type PATH with path to include directory of your MPI library

By default usage of Fortran compiler should be prohibited, but for any case search for Trilinos_ENABLE_Fortran and unset checkbox if it is set.

Then you should search for the following fields and switch them to ON:

Trilinos_ENABLE_Epetra

Trilinos_ENABLE_AztecOO

Trilinos_ENABLE_Belos

Trilinos_ENABLE_ML

Trilinos_ENABLE_Ifpack

Then click "Configure". After some time you should see that configuration completed successfully.

pic10

Then click "Generate" and look for Trilinos.sln file in trilinos_build_path.

pic11

Open it, then go to "Build/Configuration Manager".

pic12

And switch from "Debug" mode to "Release" mode.

pic13

Then Hit F7 button to compile Trilinos libraries.

After some time you should see that compilation was almost successful but one project have failed.

pic14

This may happen due to some bug in the tested version of Trilinos. Go to "View/Error List" in menu bar.

pic15

Then double click on the first error illustrated on picture below (The second error does not prevent compilation, ignore it).

pic16

Teuchos_as.hpp file should open up on line 614. Replace "t" variable with "in" variable and hit F7 again.

After some continuous time compilation will end successfully for all the projects.

pic17

If you will look into trilinos_build_path/packages directory you will see a lot of libraries located separately.

pic18

Since it wouldn't be comfortable to supply all this libraries one at a time, we should run installation script.

In order to do that create trilinos_build_path/install directory. Then open CMake and fill two fields

CMAKE_INSTALL_PREFIX of type PATH with trilinos_build_path/install

Trilinos_INSTALLATION_DIR of type PATH with trilinos_build_path/install

Then click "Configure" and "Generate".

Return to Visual Studio. There click "View/Solution Explorer".

pic19

In "Solution Explorer" right click on "INSTALL" project and click "Build".

pic20

In output you should see that all required header files and libraries were copied to trilinos_build_path/install directory.

pic21

Now you have to provide information about Trilinos to INMOST library. Open CMake again and by clicking to black triangle at the right end of the field after "Where to build the binaries" and choose your build directory for INMOST.

pic22

Find and activate USE_SOLVER_TRILINOS checkbox, then click "Add Entry" and enter the following:

TRILINOS_PATH of type PATH with trilinos_build_path/install

pic23

Then when you click "Configure" CMake should provide you with information on Trilinos:

pic24

Click "Generate" and now you can compile INMOST with Trilinos. In later times it may happen that you compile INMOST and encounter unresolved externals related to Trilinos. This happens due to some misconfiguration of Trilinos by CMake that results in all *.c files not being compiled. In order to fix it just wipe out all the trilinos_build_path directory and try to build everything from scratch.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.