Installation

Dependencies

Building (C)BLAS & LAPACK(E) from source

On Ubuntu the (C)BLAS/LAPACK(E) packages are broken. Hence, they should be built from source. We assume that the results will be installed to the <dist> directory which must be chosen accordingly by the user (e.g. $HOME/dist/).

wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz
tar -xf v3.10.1.tar.gz
cd lapack-3.10.1
mkdir build
cd build
cmake -DBUILD_TESTING=Off \
      -DBUILD_SINGLE=Off \
      -DBUILD_COMPLEX=Off \
      -DBUILD_COMPLEX16=Off \
      -DLAPACKE_BUILD_SINGLE=Off \
      -DLAPACKE_BUILD_COMPLEX=Off \
      -DLAPACKE_BUILD_COMPLEX16=Off \
      -DCBLAS=On \
      -DLAPACKE=On \
      -DBUILD_SHARED_LIBS=On \
      -DCMAKE_INSTALL_PREFIX=<dist> \
      ..
make install

Note

When building static libraries the following configuration should be added (in the above command it is implied by BUILD_SHARED_LIBS): -DCMAKE_POSITION_INDEPENDENT_CODE=On

Configuration

hddc2b uses CMake as build automation tool. For the “vanilla” configuration with a system-wide (C)BLAS/LAPACK(E) setup use the following steps:

mkdir build
cd build
cmake ..

If (C)BLAS/LAPACK(E) has been built from source, as explained above, change the cmake configuration command as follows. Use the same <dist> directory as before:

cmake -DCMAKE_PREFIX_PATH=<dist> ..

Additionally, hddc2b offers the following build-time configuration flags:

  • ENABLE_DOC to build the HTML documentation from standalone reStructuredText files and in-code Doxygen comments

  • ENABLE_TESTS to build unit tests and property tests.

  • ENABLE_TEST_COVERAGE to enable code coverage (for the unit tests). It is advised to build this project in debug mode to produce correct coverage reports.

  • ENABLE_PACKAGE_REGISTRY to add the package to CMake’s package registry. As the package registry is a somewhat “intrusive” feature it must be enabled explicitly with this flag. This is useful during development time so that a rebuild suffices, instead of also installing the package.

To use any of the flags, modify the cmake configuration command as follows where <FLAG> must be replaced with the according flag:

cmake -D<FLAG>=On ..

CMake presets

hddc2b provides the following CMake presets, i.e. specialized settings that should not be included in the default configuration:

  • To enable address sanitization:

    cmake --preset=asan
    
  • To enable additional warnings:

    cmake --preset=add-warn
    
  • For fast math (auto vectorization) use:

    cmake --preset=math-opt
    

Building and installation

After the configuration the following command builds the project:

make

If the package registry has been enabled during the configuration, already now the hddc2b package is accessible to other CMake projects via the find_package command. Otherwise, for a user- or system-wide installation execute:

make install

Running tests

If the tests have been enabled during the configuration, they can now be executed via either of the following commands (the former only shows an overview whereas the latter is more verbose):

make test
test/main_test

Test coverage

If the test coverage has been enabled, the coverage report can be generated by executing the following command:

make coverage

If the test run succeeds, the HTML coverage report can be accessed via the file build/coverage/index.html.

Running example

If the tests have been enabled during the configuration, they can now be executed via either of the following commands (the former only shows an overview whereas the latter is more verbose):

src/example/hddc2b_example

Building documentation

If the documentation option has been enabled, the make command writes the documentation to the build/hddc2b_sphinx directory.