MEmilio
0.7
|
The MEmilio C++ library contains the implementation of the epidemiological models.
Directory structure:
MEmilio C++ uses CMake as a build configuration system (https://cmake.org/)
MEmilio C++ is regularly tested with the following compilers (list will be extended over time):
MEmilio C++ is regularly tested on gitlub runners using Ubuntu 18.04 and 20.04 and Windows Server 2016 and 2019. It is expected to run on any comparable Linux or Windows system. It is currently not tested on MacOS.
The following table lists the dependencies that are used. Most of them are required, but some are optional. The library can be used without them but with slightly reduced features. CMake will warn about them during configuration. Most of them are bundled with this library and do not need to be installed manually. Bundled libraries are either included with this project or loaded from the web on demand. For each dependency, there is a CMake option to use an installed version instead. Version compatibility needs to be ensured by the user, the version we currently use is included in the table.
Library | Version | Required | Bundled | Notes |
---|---|---|---|---|
spdlog | 1.11.0 | Yes | Yes (git repo) | https://github.com/gabime/spdlog |
Eigen | 3.3.9 | Yes | Yes (git repo) | http://gitlab.com/libeigen/eigen |
Boost | 1.84.0 | Yes | Yes (git repo) | https://github.com/boostorg/boost |
JsonCpp | 1.9.5 | No | Yes (git repo) | https://github.com/open-source-parsers/jsoncpp |
HDF5 | 1.12.0 | No | No | https://www.hdfgroup.org/, package libhdf5-dev on apt (Ubuntu) |
GoogleTest | 1.10 | For Tests only | Yes (git repo) | https://github.com/google/googletest |
See the thirdparty directory for more details.
To configure with default options:
Options can be specified with cmake .. -D<OPTION>=<VALUE>
or by editing the build/CMakeCache.txt
file after running cmake. The following options are known to the library:
MEMILIO_BUILD_TESTS
: build unit tests in the test directory, ON or OFF, default ON.MEMILIO_BUILD_EXAMPLES
: build the example applications in the examples directory, ON or OFF, default ON.MEMILIO_BUILD_MODELS
: build the separate model libraries in the models directory, ON or OFF, default ON.MEMILIO_BUILD_SIMULATIONS
: build the simulation applications in the simulations directory, ON or OFF, default ON.MEMILIO_USE_BUNDLED_SPDLOG/_BOOST/_EIGEN/_JSONCPP
: use the corresponding dependency bundled with this project, ON or OFF, default ON.MEMILIO_BUILD_BENCHMARKS
: build the benchmarks for this project, ON or OFF, default OFF.MEMILIO_SANITIZE_ADDRESS/_UNDEFINED
: compile with specified sanitizers to check correctness, ON or OFF, default OFF.MEMILIO_ENABLE_OPENMP
: compile MEmilio with multithreading using OpenMP, ON or OFF, default OFF.MEMILIO_ENABLE_MPI
: compile MEmilio with distributed memory parallelization using MPI. ON or OFF, default OFF. Requires an MPI implementation to be installed on the system.MEMILIO_ENABLE_WARNINGS
: enable compilation warnings (beyond those enabled in the compiler by default). ON or OFF, default ON.MEMILIO_ENABLE_WARNINGS_AS_ERRORS
: compilation warnings are treated as compilation errors. ON or OFF, default ON.MEMILIO_ENABLE_PROFILING
: compile with runtime profiling support. ON or OFF, default OFF. See here for information.Other important options may need:
CMAKE_BUILD_TYPE
: controls compiler optimizations and diagnostics, Debug, Release, or RelWithDebInfo; not available for Multi-Config CMake Generators like Visual Studio, set the build type in the IDE or when running the compiler.CMAKE_INSTALL_PREFIX
: controls the location where the project will be installedHDF5_DIR
: if you have HDF5 installed but it is not found by CMake (usually on the Windows OS), you may have to set this option to the directory in your installation that contains the hdf5-config.cmake
file.To e.g. configure the build without unit tests and with a specific version of HDF5:
After configuring, make the library using cmake:
Run the unittests with:
Run an example with:
Install the project at the location given in the CMAKE_INSTALL_PREFIX
variable with:
This will install the libraries, headers, and executables that were built, i.e. where MEMILIO_BUILD_<PART>=ON
.
Using CMake, integration is simple.
If you installed the project, there is a memilio-config.cmake
file included with your installation. This config file will tell CMake which libraries and directores have to be included. Look up the config using the command find_package(memilio)
in your own CMakeLists.txt
. On Linux, the file should be found automatically if you installed in the normal GNU directories. Otherwise, or if you are working on Windows, you have to specify the memilio_DIR
variable when running CMake to point it to the memilio-config.cmake
file. Add the main framework as a dependency with the command target_link_libraries(<your target> PRIVATE memilio::memilio)
. Other targets that are exported are memilio::secir
, memilio::seir
, and memilio::abm
. This will set all required include directories and libraries, even transitive ones.
Alternatively, MEmilio
can be integrated as a subdirectory of your project with add_subdirectory(memilio/cpp)
, then you can use the same target_link_libraries
command as above.
add_subdirectory
way.