Build SU2 From Source

This guide is for version 7 only. For information on how to build older versions of SU2, have a look here.

Quick Compilation Guide

This is a quick guide to compile and install a basic version of SU2. For more information on the requirements and a more detailed description of the build system continue reading the rest of this page.

Short summary of the minimal requirements:

  • C/C++ compiler
  • Python 3

Note: all other necessary build tools and dependencies are shipped with the source code or are downloaded automatically.

If you have these tools installed, you can create a configuration using the found in the root source code folder:

 ./ build

Use ninja to compile and install the code

./ninja -C build install



Installing SU2 from source requires a C++ compiler. The GNU compilers (gcc/g++) are open-source, widely used, and reliable for building SU2. The Intel compiler set has been optimized to run on Intel hardware and has also been used successfully by the development team to build the source code, though it is commercially licensed. The Apple LLVM compiler (Clang) is also commonly used by the developers.

  • GNU gcc / g++
  • Intel icc / icpc
  • Apple LLVM (clang)

Note: SU2 uses some C++11 features, that means at least GCC >= v4.7, Clang >= v3.0 or Intel C++ >= v12.0 is necessary.


In order to build SU2 with parallel support, you need a suitable MPI installation on your machine. During the configuration the build tool does a check and enables MPI support. If no installation is found, a serial version of SU2 will be compiled.


SU2 requires Python 3 for compilation and for running the python scripts. Make sure that you have properly set up the python3 executables in your environment.

Optional: swig and mpi4py

If you want to use the python wrapper capabilities, also swig and mpi4py are required. On Linux swig should be available in the package manager of your distribution and mpi4py can be installed using pip.

On Mac OS X, you can use the Homebrew package manager. Once it is installed on your system, you can install Swig by running:

$ sudo brew install swig

Install mpi4py with Python pip using easy install:

$ sudo easy_install pip
$ sudo pip install mpi4py

Automatically installed dependencies

The following dependencies are automatically downloaded (or initialized if source code was cloned using git) during the configuration.

Meson and Ninja

The build system of SU2 is based on a combination of meson (as the front-end) and ninja (as the back-end). Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible. Ninja is a small low-level build system with a focus on speed.

CoDiPack and MeDiPack

In order to use the discrete adjoint solver the compilation requires two additional (header-only) libraries. CoDi provides the AD datatype and MeDi provides the infrastructure for the MPI communication when the reverse mode of AD is used.

Configuration and Compilation

Like mentioned above, SU2 uses meson and ninja for configuration and compilation, respectively. A configuration using meson is generated first and then an invocation of ninja is used to compile SU2 with this configuration.

Basic Configuration

In the root folder of the sources you will find a python script called This script generates a configuration. It will also check whether all dependencies are found and downloads some of them if necessary see previous section.

Note: For the following steps you can also use preinstalled versions of meson and ninja available on your machine. Just replace the ./ and ./ninja calls with the binaries of the respective installations. However, this way you have to manually make sure that the correct versions of CoDiPack and MeDiPack are placed in the externals/ folders.

The only required argument for is a name of a directory where it should store the configuration. You can have multiple configurations in different folders next to each other. To generate a basic configuration that will be stored in the folder build use

 ./ build

Options can be passed to the script to enable or disable different features of SU2. Below you find a list of project options and their default values:

Option Default value Description
-Denable-autodiff false enable AD (reverse) support (needed for discrete adjoint solver)
-Denable-directdiff false enable AD (forward) support
-Denable-pywrapper false enable Python wrapper support
-Dwith-mpi auto Set dependency mode for MPI (auto,required,disabled)
-Denable-cgns true enable CGNS support
-Denable-tecio true enable TECIO support

For example to enable AD support pass the option to the script along with a value:

./ build -Denable-autodiff=true

To set a installation directory for the binaries and python scripts, use the --prefix option, e.g.:

./ build -Denable-autodiff=true --prefix=/home/username/SU2

If you are not interested in setting custom compiler flags and other options you can now go directly to the Compilation section, otherwise continue reading the next section.

Advanced Configuration

In general meson appends flags set with the environment variable CXX_FLAGS. It is however recommended to use mesons built-in options to set debug mode, warning levels and optimizations. All options can be found here or by using ./ configure. An already created configuration can be modified by using the --reconfigure flag, e.g.:

./ build --reconfigure --buildtype=debug

Note that it is only possible to change one option at once.

Build Type

The debug mode can be enabled by using the --buildtype=debug option. This adds -g flag and disables all compiler optimizations. If you still want to have optimizations, use --buildtype=debugoptimized. The default build type is release.

Compiler optimizations

The optimization level can be set with --optimization=level, where level corresponds to a number between 0 (no optimization) and 3 (highest level of optimizations). The default level is 3.

Warning level

The warning level can be set with --warnlevel=level, where level corresponds to a number between 0 (no warnings) and 3 (highest level of warning output). Level 1 corresponds to -Wall, level 2 to -Wall -Wextra and level 3 to -Wall -Wextra -Wpedantic. The default level is 0.

Note: The warning flags -Wno-unused-parameter, -Wno-empty-body and -Wno-format-security are always added by default.


Finally to compile and install SU2 use

./ninja -C build install

where build is again a folder with a configuration created using a call to described in the previous section. By default ninja uses all available cores in your system for the compilation. You can set the number of cores manually by using the -jN flag, where N is the number of cores you want to use.


MPI installation is not found

Meson looks for an MPI installation using pkg-config. But if your MPI implementation does not provide them, it will search for the standard wrapper executables, mpic, mpicxx, mpic++. If these are not in your path, they can be specified by setting the standard environment variables MPICC, MPICXX during configuration.

mpi4py library is not found

The build system uses get_python_lib() to look for the library installation path. If mpi4py is not installed in that path, you can provide a custom library path with --python_path=<path_to_library>.

Improve this page