Building GEOS
Build steps
Create a host-config file that sets all system-specific CMake variables. Take a look at host-config examples. We recommend the same host-config is used for both TPL and GEOS builds. In particular, certain options (such as
ENABLE_MPIorENABLE_CUDA) need to match between the two.Provide paths to all enabled TPLs. This can be done in one of two ways:
Provide each path via a separate CMake variable (see Third-party dependencies for path variable names).
If you built TPLs from the
tplMirrorrepository, you can setGEOSX_TPL_DIRvariable in your host-config to point to the TPL installation path, andinclude("/path/to/GEOS/host-configs/tpls.cmake")
which will set all the individual TPL paths for you.
Configure via
config-build.pyscript:cd GEOS python scripts/config-build.py --hostconfig=/path/to/host-config.cmake --buildtype=Release --installpath=/path/to/install/dir
where
--buildpathor-bpis the build directory (by default, created under current working dir).--installpathor-ipis the installation directory(wrapsCMAKE_INSTALL_PREFIX).--buildtypeor-btis a wrapper to theCMAKE_BUILD_TYPEoption.--hostconfigor-hcis a path to host-config file.all unrecognized options are passed to CMake.
If
--buildpathis not used, build directory is automatically namedbuild-<config-filename-without-extension>-<buildtype>. It is possible to keep automatic naming and change the build root directory with--buildrootdir. In that case, build path will be set to<buildrootdir>/<config-filename-without-extension>-<buildtype>. Both--buildpathand--buildrootdirare incompatible and cannot be used in the same time. Same pattern is applicable to install path, with--installpathand--installrootdiroptions.Run the build:
cd <buildpath> make -j $(nproc)
You may also run the CMake configure step manually instead of relying on config-build.py.
A full build typically takes between 10 and 30 minutes, depending on chosen compilers, options and number of cores.
Configuration options
Below is a list of CMake configuration options, in addition to TPL options above.
Some options, when enabled, require additional settings (e.g. ENABLE_CUDA).
Please see host-config examples.
Option |
Default |
Explanation |
|---|---|---|
|
|
Build with MPI (also applies to TPLs) |
|
|
Build with OpenMP (also applies to TPLs) |
|
|
Build with CUDA (also applies to TPLs) |
|
|
Enable CUDA NVTX user instrumentation (via GEOS_MARK_SCOPE or GEOS_MARK_FUNCTION macros) |
|
|
Build with HIP/ROCM (also applies to TPLs) |
|
|
Build documentation (Sphinx and Doxygen) |
|
|
Treat all warnings as errors |
|
|
Enables TotalView debugger custom view of GEOS data structures |
|
|
Enables code coverage |
|
|
Enables unit testing targets |
|
|
Maximum component count instantiated in compositional flow solvers (3 to 20) |
|
|
Choiсe of Linear Algebra backend (Hypre/Petsc/Trilinos) |
|
|
Use CMake Object Libraries build |
|
|
Build |
|
Max. number of compile jobs (when using Ninja), in addition to |
|
|
Max. number of link jobs (when using Ninja), in addition to |
|
|
|
Enables schema generation and installation |
Compositional component limit
Set GEOS_MAX_FLUID_COMPONENTS in the host configuration or pass, for example,
-DGEOS_MAX_FLUID_COMPONENTS=20 to CMake to build compositional flow solvers for up to
twenty components. The default of five preserves the existing solver range.
To build for more components:
Add
set( GEOS_MAX_FLUID_COMPONENTS 20 CACHE STRING "" )to the host-config file, or pass-DGEOS_MAX_FLUID_COMPONENTS=20on the CMake command line.Reconfigure the build directory (
cmakeorconfig-build.py).Rebuild GEOS.
No source changes are needed. In particular, kernelSpecs.json does not have to be
edited: each NCOMP list there gives only the lowest instantiated component count,
and CMake extends it to GEOS_MAX_FLUID_COMPONENTS when the build is configured.
Values must be integers from three to twenty; smaller limits reduce compilation
work and the number of kernel instantiations. One-component kernels remain
available at every supported setting. Three is the minimum build limit because
black-oil fluids require three components; two-component fluid models remain
available in every supported build. The count includes every modeled fluid
species, including water when present.
This setting controls both runtime dispatch and explicit instantiations, including thermal, hybrid finite-volume, aquifer, CFL and well kernels. Solvers reject models exceeding the configured limit during setup, with a message identifying the required setting. Changing the option requires reconfiguring and rebuilding GEOS.
The constitutive fluid working arrays have capacity for at least nine components
and grow with GEOS_MAX_FLUID_COMPONENTS above nine. Smaller builds retain existing
nine-component standalone fluid-property calculations, such as the PVT driver.
The table-based reactive OBL solver uses the smaller of the configured limit and
seven components. Its per-thread interpolation workspace grows exponentially with
the component count and would exceed the CUDA local-memory limit at eight, so
increasing GEOS_MAX_FLUID_COMPONENTS above seven extends the EOS compositional
solvers without increasing the OBL limit.