In order to build DUNE you need at least the following software:

  • C++ compiler supporting c++-17 language standard, e.g. clang >= 5, g++ >= 7
  • CMake >= 3.13
  • pkg-config

Detailed information on supported compiler and CMake versions can be found in the release notes for releases and in the list recent changes for the development branch master.

The following software is recommend but optional:

  • MPI (either OpenMPI, lam, or mpich suffice)

This will provide you with the core DUNE features.

Some DUNE modules might support further software. Using this software is optional. The dune-grid module for example supports different external grid managers like Alberta; these have to be downloaded separately. For a list of supported contrib software packages and their installation see the notes on Installation External Libraries.

Installing the core DUNE modules

First you need to download the DUNE core modules to your computer in one common directory. You can either download tarballs of the last releases of the core modules or download directly from our git repositories. Note: If you download the modules directly from git make sure to checkout a release branch if you don’t want to work with the current development version.

To compile the modules DUNE has to check several components of your system and whether prerequisites within the modules are met. For the ease of users we have designed a custom build system on top of CMake. Run

./dune-common/bin/dunecontrol all

to commence those tests and build all modules you have downloaded. Don’t worry about messages telling you that libraries are missing: they are only needed for grid-self-checks we need for developing or for additional features.

By default, an individual build directory is created inside each module. You can modify this behavior by adding the --builddir<directory_name> option. By choosing an absolute path here you can specify a custom build directory at an arbitrary location:

./dune-common/bin/dunecontrol --builddir=/my/build/directory

You can customize the build to your specific needs by using an options file (see below)

./dune-common/bin/dunecontrol --opts=/path_to/file.opts

If you want to have a system wide installation of DUNE you can call

./dune-common/bin/dunecontrol make install

This tries to install DUNE in the default install location known to CMake. Typically this is /usr/local. You may need root-permissions for the install part depending on the prefix set. See below, for passing additional parameters to CMake and make for, e.g., specifying the installation prefix. It is often not necessary to actually install DUNE, just configuring and building is enough.

The CMake documentation provides additional helpful information.

Installing other DUNE modules

Besides the core modules you can find lots of other dune modules:

If you want to use one of those modules make sure to download the module and all dependencies in one common directory. If you want to work on a release branch (and not the current development branch) you have to make sure to checkout the right branch of your modules if you cloned via git. Building your modules is done in the same way as building the core modules.

Building a Specific DUNE Module (and its dependent modules)

You can instruct dunecontrol to build only a certain dune module, using the --only=<module_name> switch. Running dunecontrol script

./dune-common/bin/dunecontrol --only=<module_name> all

where <module_name> is the name of that particular module given in the dune.module file, will build only the module <module_name>.

If you want to build a module and the modules it depends on, you must run:

./dune-common/bin/dunecontrol --module=<module_name> all

Passing Options to the Build Process

The general structure of a dunecontrol call is

dunecontrol [OPTIONS] COMMAND

where the following atomic commands can be executed:

  • cmake: runs the CMake configure tests for each module
  • make: runs make (or any other build tool that was configured) for each module
  • all: combination of cmake and make
  • exec: executes a command in each module directory
  • bexec: executes a command in each module’s build directory
  • update: pull the latest version from the Git repository
  • git: run a specific git command in all module directories

As it is often not convenient to specify the desired options after the dunecontrol call, one can pass the options via file specified by the --opts=<file> option. Specify the options via the variable CMAKE_FLAGS=<flags>

An example of an options file is

# use a special compiler (g++ version 9.0),
# install to a custom directory, default is /usr/local/bin,
# disable the external library SuperLU,
# and use Ninja-build instead of make as the build-tool
             -DCMAKE_INSTALL_PREFIX=/path/where/to/install/dune \
             -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=true \

Creating your own DUNE project module

You can create your own dune project module by using the duneproject script available in dune-common/bin directory. Running the script will create a directory with supporting files (CMakeLists.txt etc.) and a sample .cc file. After creating the module you can build this as explained above under “Building a specific DUNE module”.

The DUNE Build System Documentation will also give you an excellent introduction to the build system and how to create new modules/projects your own.

Installing DUNE in HPC Clusters

Cluster architectures often have a linux based system that is quiet different from a desktop environment, with its own package management system that needs special handling of the installation such that everything is found properly. We cannot give instructions for all HPC systems, but link some general resources related to DUNE:

However, often it is enough to just load the build dependencies and build DUNE using dunecontrol the classical way.


My System does not provide the required minimal compiler version. Where can I find updates?

This heavily depends on your system. For Debian/Ubuntu based Linux distributions, sources are:

Follow the instruction on the referenced pages.

How can I update my system CMake version?

Similar to the compilers, it depends on your distribution:

My dune packages are located in different directories. How can I find them using dunecontrol?

The dunecontrol script searches in the current directory and all its subdirectories for files name dune.module. Those files contain the information about the corresponding dune module and its dependencies. Additionally, dunecontrol searches in all directories (and subdirectories of those) listed in the variable DUNE_CONTROL_PATH. Similarly to the PATH variable, directories are separated by colon :.

You can either prefix the call of dunecontrol to individually specify the search paths, i.e.,

DUNE_CONTROL_PATH=path/to/module1:/path/to/module2 dunecontrol [...] COMMAND

or you can put this path information into an options file, next to the other options like CMAKE_FLAGS or MAKE_FLAGS.

Creative Commons License   |  Legal Statements / Impressum  |  generated with Hugo v0.55.6 (Oct 19, 22:22, 2020)