Skip to content

HOWTO interface a new dependency library

Andrea Lani edited this page Oct 5, 2017 · 18 revisions

COOLFluiD already depends on a few packages, whose main ones are reviewed here. If you need to interface a new package, there are a few necessary steps that you have to follow, requiring the following modifications:

  1. prepare.pl: you need to define a set of new variables to be configured in the coolfluid.conf;
  2. root CMakeLists.txt: the new variables have to be mapped to cmake environmental variables;
  3. module (kernel or plugin) CMakeLists.txt: binding to library and include paths must be created;
  4. coolfluid.conf: you have to set the new variables to the corresponding values.

There are plenty of examples one can look at, but for illustrative purposes we will analyze in details what each step required for interfacing the Mutation++ library. The following offers a quite representative and sufficiently complex scenario.

1) prepare.pl modifications

We add the new package to the list of dependency libraries:

my @libraries = (..., "mutationpp", ...).

This will create the environmental variable MUTATIONPP_HOME.

We create some new variables (e.g. flags, library and include paths) and set default values inside my %default_options = (...):

  • 'with_mutationpp' => 0, : this flag controls whether the library is activated;
  • 'mutationpp_dir' => "",: this string gives the root path of the library;
  • 'mutationpp_librarydir' => "/usr/lib64",: this string gives the library path;
  • 'mutationpp_includedir' => "/usr/include",: this tring gives the include path.

We map library and include paths to environmental variables (MUTATIONPP_LIBRARYDIR, MUTATIONPP_INCLUDEDIR) by declaring them as:

my @dep_variables = ( ..., "mutationpp_librarydir", "mutationpp_includedir").

We directly map the activation flag to an environmental variable to be used later:

setup_option('with_mutationpp', 'CF_ENABLE_MUTATIONPP');

2) Root CMakeLists.txt modifications

We introduce some conditional behavior depending on the library activation flag:

IF ( CF_ENABLE_MUTATIONPP ) FIND_PACKAGE(Mutationpp) ADD_DEFINITIONS ( -DCF_HAVE_MUTATIONPP ) ENDIF()

In particular, we define an environmental variable CF_HAVE_MUTATIONPP that will be visible inside other cmake files and, if needed, inside the C++ code itself.

A cmake/FindMutationpp.cmake needs to be implemented: this wil set the environmental variables MUTATIONPP_INCLUDE_DIR, MUTATIONPP_LIBRARY and CF_HAVE_MUTATIONPP, starting from the user-defined MUTATIONPP_HOME, MUTATIONPP_LIBRARYDIR and MUTATIONPP_INCLUDEDIR.

3) Module CMakeLists.txt modifications

Inside plugins/MutationppI/CMakeLists.txt we update the include and library paths:

LIST ( APPEND MutationppI_includedirs ${MUTATIONPP_INCLUDE_DIR} ) LIST ( APPEND MutationppI_libs ${MUTATIONPP_LIBRARY} )

4) coolfluid.conf modifications

We set the values of all new variables, previously defined within the prepare.pl:

with_mutationpp = 1 mutationpp_dir = /Users/lani/mutation++ mutationpp_includedir = /Users/lani/mutation++/install/include/mutation++ mutationpp_librarydir = /Users/lani/mutation++/install/lib

NOTE: once you have done all steps 1-4, in order to update your configuration to take into account the changes, you need to:

  • update your library path: export LD_LIBRARY_PATH=/Users/lani/mutation++/install/lib:$LD_LIBRARY_PATH;
  • completely remove your existing build directory (e.g. optim);
  • reconfigure again with ./prepare.pl --build=optim (or similar);
  • compile with make inside the optim (or whatever other build directory you have).

Contacts

Home

Gallery

HOWTO

2019 NASA Ames presentation

2014 NASA Ames presentation


parallel computations of complex problems

Parallel mesh decomposition


Scalability in large scale simulation

High-performance computing (strong scaling on NASA Pleiades for 1/2 billion-cells 3D grid)


Modeling of high-speed reacting flows and plasma

Chemically reacting flows and plasma


Numerical Schlieren of turbulent flow on wing computed with RDS-LES

Complex all-speed flow simulations

Clone this wiki locally