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
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
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:
You can customize the build to your specific needs by using an options file (see below)
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
./dune-common/bin/dunecontrol --only=<module_name> all
<module_name> is the name of that particular module given in the dune.module file,
will build only the module
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
- 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
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 CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++-9 \ -DCMAKE_INSTALL_PREFIX=/path/where/to/install/dune \ -DCMAKE_DISABLE_FIND_PACKAGE_SuperLU=true \ -GNinja"
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:
- There is a DUNE package for the Spack package management system, see https://gitlab.dune-project.org/spack/dune-spack for more information
- Installing Dune in a system using EasyBuild as software management system requires the description of the DUNE modules and its dependencies in EasyConfig files. See https://gitlab.mn.tu-dresden.de/spraetor/dune-easybuild for some examples.
- Some old instructions for the BlueGene-P system can be found in the Installation Notes for Blue Gene P.
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:
- PPA for recent gcc/g++ compilers for various ubuntu distributions: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
- APT repository for clang (debian and ubuntu packages): https://apt.llvm.org
Follow the instruction on the referenced pages.
How can I update my system CMake version?
Similar to the compilers, it depends on your distribution:
- APT repository from Kitware: https://apt.kitware.com
- Snap package: https://snapcraft.io/cmake (for RHEL, see https://snapcraft.io/install/cmake/rhel)
- Using PIP:
python -m pip install cmake
- docker container including CMake: e.g. https://registry.dune-project.org/docker/ci/ubuntu:20.04 or https://registry.dune-project.org/docker/ci/debian:10
- Binary from Kitware website: https://cmake.org/download + add
CMAKE="YOUR_PATH/bin/cmake"to your options file.
- Compile CMake from source: https://cmake.org/download, using your old CMake.
My dune packages are located in different directories. How can I find them using dunecontrol?
dunecontrol script searches in the current directory and all its subdirectories for files name
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