As of release 2.0, SU2 uses the GNU automake tools to configure and build the software from source in Linux and Mac environments. To compile the most basic version of SU2 (single-threaded with no optional features and no compiler optimization), navigate to "your_SU2/trunk" and follow the usual steps after extracting the source code:
- ./configure (make sure to note the SU2_RUN and SU2_HOME variables displayed at the conclusion of configure)
- make install
To use the more advanced features of SU2, you will need to add environment variables and update your path.
Tuning of the build process, setting environment variables, and adding optional features is discussed below.
GNU Autoconf / Automake Tools
These tools are widely used and frequently installed with most installations of Linux and Max OS. Please check your system to ensure these tools are available prior to installation.
Installing SU2 from source requires a C++ compiler. Gnu gcc/g++ compilers 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. Academic licenses for the Intel compiler set are affordable for those who qualify.
When make install is complete, define the $SU2_HOME and $SU2_RUN environment variables, and update your $PATH with $SU2_RUN. For the basic installation, these values will be displayed at the conclusion of ./configure from the steps above.
$SU2_RUN should point to the folder where all binaries and python scripts were installed.
$SU2_HOME should point to the source code's trunk folder.
For example, add these lines to your ~/.bashrc (linux) or ~/.bash_profile (macosx) file -
Before building SU2 must run the configuration script which will scan your system for the necessary prerequisites and generate the appropriate makefiles. The simplest version of SU2 can be configured by running configure with no arguments:
This will configure serial (non-MPI) versions of all SU2 programs with no CGNS or METIS support. The configure tool will attempt to find a C++ compiler on your system and set some default flags if none are specified. It is strongly recommended, however, that the environment variables used by configure be set before configuring (especially CXX and CXXFLAGS). Numerous flags are available to activate or deactivate optional features. These include CGNS (http://cgns.sourceforge.net/) support, METIS (http://glaros.dtc.umn.edu/gkhome/metis/metis/overview) support, compiler flags for optimization and fine tuning, and the selection of specific programs to build or ignore (usually only required by developers). A complete list of optional features and relevant environment variables is shown by running ./configure --help. Configure help is copied here for reference:
`configure' configures SU^2 2.0 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
--prefix=PREFIX install architecture-independent files in PREFIX [/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX]
By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/SU^2]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-CFD build the SU2_CFD executable (default = yes)
--disable-DDC build the SU2_DDC executable (default = yes)
--disable-GPC build the SU2_GPC executable (default = yes)
--disable-MAC build the SU2_MAC executable (default = yes)
--disable-MDC build the SU2_MDC executable (default = yes)
--disable-PBC build the SU2_PBC executable (default = yes)
--disable-SMC build the SU2_SMC executable (default = yes)
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-MPI=ARG Build parallel version with MPI tools, ARG = MPI C++
--with-CGNS-lib=ARG CGNS library directory, ARG = path to libcgns.a
--with-CGNS-include=ARG CGNS include directory, ARG = path to cgnslib.h
--with-Tecio-lib=ARG Tecplot i/o library directory, ARG = path to libtecio.a
--with-Tecio-include=ARG Tecplot i/o include directory, ARG = path to TECIO.h
--with-Metis-lib=ARG Metis library directory, ARG = path to libmetis.a
--with-Metis-include=ARG Metis include directory, ARG = path to metis.h
--with-Metis-version=ARG Metis major version, ARG = 4 (default) or 5
Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations.
Report bugs to <email@example.com>.
To configure SU2 for parallel (that is to say with MPI support) and with all optional features, the configure command would look like this (replace with specific paths on your system):
./configure --prefix=/path/to/install/SU2 --with-CGNS-lib=/path/to/CGNS/lib --with-CGNS-include=/path/to/CGNS/headers --with-Metis-lib=/path/to/METIS/lib --with-Metis-include=/path/to/METIS/headers --with-Metis-version=5 --with-MPI=/path/to/mpicxx
When defining the installation path via --prefix note that you will need write access to the destination folder when installing after compiling (see below). You can switch to a privileged user (or sudo) before installing if necessary. Note that you do not need to rerun the configuration tool unless you modify the options. Updating the source code and rebuilding does not require reconfiguring.
After configuring, compile SU2:
If no errors are encountered you are ready to install.
After compiling you are ready to install SU2.
This will copy the programs any Python scripts comprising the SU2 suite to the folder you selected with the --prefix flag during configuration (/usr/local/bin if --prefix was not defined). As noted above you will need write access to the destination folder to install.
To clean the SU2 source tree (remove all intermediate object files):
This is recommended if you modify the configuration and / or update the source code before rebuilding.