Compile and Build

Dependencies

Building requires installing the following dependencies:

  • gcc (or any C++17-compliant compiler)

  • CMake >=3.9 for building,

  • Eigen3 >=3.4.0 for handling linear algebra,

  • Ceres >=2.0.0 for solving non-linear system of equations,

  • HDF5 library with HighFive >=2.8 interface for writing/reading states to HDF5 format,

  • nlohmann_json >=3.10 for reading JSON configuration files.

All these dependencies except HighFive are available through standard UNIX package managers. Instructions to install HighFive can be obtained in their repository.

Note

CMake offers version compatibility check for all these dependencies.

The locations of all the libraries need to be noted especially where these were not installed through standard package managers.

Additional requirements are required for plot scripts in the demo,

All these libraries are also available either through standard UNIX package managers (for a system-wide installation) or Python package manager, pip (for a local installation).

A requirements.txt file is also included to install python dependencies for convenience, and maybe installed using

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r requirements.txt

Configure and Compile

Once the dependencies are available, the following sequence of commands builds the project executables.

Current working directory is assumed as the top-level project directory and the build files will be placed in build directory.

cmake -B build -S .

This configures the project by finding the dependencies and generating host-specific build instructions.

CMake looks for the dependencies in standard UNIX paths, but if any of the dependencies are at a custom location their paths may be indicated by e.g.,-DCMAKE_PREFIX_PATH="/path/to/ceres;/path/to/highfive".

Automatic differentiation is enabled by default for Jacobian construction. If you prefer to use finite-difference based numeric differentiation, configure with -DPHGASNETS_NUMERICDIFF=ON flag. Read more about how automatic derivatives are computed here.

To compile in debug mode, you need to disable excessive compiler optimizations so as to utilize debuggers like gdb. Configure using -DCMAKE_BUILD_TYPE="Debug" flag.

To compile and create executables,

cmake --build build

Run Demos

The demo executables are available in the build directory and take configuration parameters config.json as input.

A convenience script RUNME.sh is provided to run all the demos and plot results,

./RUNME.sh

Note

For detailed description on each demo, refer to the READMEs within.