-
Notifications
You must be signed in to change notification settings - Fork 45
Tips and tricks
By default FABM includes biogeochemical models from all "institute directories" under src/models
. You can restrict this to a subset of directories by providing -DFABM_INSTITUTES=<INSTITUTES>
as argument to cmake. Here, <INSTITUTES>
is a semi-colon-separated list of institute names. You may need to enclose this list in quotes to prevent the shell from interpreting the semi-colon.
While you are developing new biogeochemical models or couplers that link FABM with a new host, it is highly recommended to compile FABM in debug mode. This is done by providing -DCMAKE_BUILD_TYPE=Debug
as argument to cmake. In debug mode, FABM performs many more runtime checks. For instance, it verifies whether biogeochemical models actually provide values for the diagnostics they have registered, and it checks the extent of arrays provided by the host model. This comes at the expense of computational performance and is therefore not recommended for production runs. It is very useful for debugging though.
Note that -DCMAKE_BUILD_TYPE=Debug
only activates additional checks by FABM itself. It does not activate runtime checks by the compiler, e.g., to catch out-of-bounds array access or use of uninitialized variables. Such checks are valuable. For instance, they are the only way to detect that a model variable is accessed without having been registered. To activate runtime checks, you typically need to set compiler flags such as -fcheck=all
for gfortran, or -check all
for Intel Fortran. See the next section.
By default, cmake will choose the flags that will be provided to the Fortran compiler. These flags are based on the value of the FFLAGS
environment variable, the detected Fortran compiler and the selected build configuration (debug, release, etc). They are internally stored as one general set (CMAKE_Fortran_FLAGS
) and one set of additional flags per build configuration (e.g., CMAKE_Fortran_FLAGS_RELEASE
, CMAKE_Fortran_FLAGS_DEBUG
). When you compile, the general and configuration-specific flags are combined. You can control the flags in several different ways:
- You can run cmake with default settings first, and then in the build directory run
ccmake .
This allows you to see and edit all active cmake options, including the compiler flags (after you pressT
to make advanced options visible). - You can provide
-DCMAKE_Fortran_FLAGS=<FLAGS>
to cmake to override the general set of compiler flags. This can also be achieved by setting theFFLAGS
environment variable before the first call to cmake. - You can provide flags per build configuration by providing
-DCMAKE_Fortran_FLAGS_DEBUG=<FLAGS>
or-DCMAKE_Fortran_FLAGS_RELEASE=<FLAGS>
to cmake. Remember that these will be added to the general set.
For questions about FABM's use or development, visit Discussions. If you would like to cite FABM, please refer to its main publication and/or URLs.
Background
User guide
- Obtaining the source code
- Building and installing
- Setting up a simulation
- Available biogeochemical models
- Specific hosts
Developer guide
Updates
Tips and tricks
Support
How to cite
Licensing and copyright
Acknowledgements
Presentations
Workshops