Skip to content

Commit 3bfd4da

Browse files
committed
Merge branch 'main' into parallel-processing
2 parents 9a8c4ef + 77e510d commit 3bfd4da

150 files changed

Lines changed: 1576 additions & 1979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/linux-build/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ runs:
4040
sudo apt-get -qq update
4141
sudo apt-get -qq -y install lcov ccache
4242
if [[ "${{ inputs.optional-dependencies }}" == "ON" ]]; then
43-
sudo apt-get -qq -y install libhdf5-dev
43+
sudo apt-get -qq -y install libhdf5-dev
4444
fi
4545
if [[ "${{ inputs.compiler }}" == "gcc" ]]; then
4646
if [[ "${{ inputs.version }}" == "min" ]]; then
@@ -97,7 +97,7 @@ runs:
9797
exit 1
9898
fi
9999
mkdir -p build && cd build
100-
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} ..
100+
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} -DMEMILIO_ENABLE_HDF5=${{ inputs.optional-dependencies }} ..
101101
make -j4
102102
- name: create build dir archive
103103
shell: bash

.github/actions/linux-test/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ runs:
2727
shell: bash
2828
run: |
2929
sudo apt-get -qq update
30-
sudo apt-get -qq -y install libhdf5-10* wget gnupg lcov
30+
sudo apt-get -qq -y install wget gnupg lcov
31+
if [[ "${{ inputs.optional-deps }}" == "ON" ]]; then
32+
sudo apt-get -qq -y install libhdf5-10*
33+
fi
3134
sudo apt-get -qq update
3235
- name: Download built test directory
3336
uses: actions/download-artifact@v4

.github/actions/sbml-test/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ runs:
3838
shell: bash
3939
run: |
4040
cd cpp/build
41-
cmake -DCMAKE_BUILD_TYPE=Release -Dsbml_DIR=/usr/lib/x86_64-linux-gnu/cmake ..
41+
cmake -DCMAKE_BUILD_TYPE=Release -DMEMILIO_ENABLE_SBML=ON -Dsbml_DIR=/usr/lib/x86_64-linux-gnu/cmake ..
4242
cmake --build . -j 4
4343
- name: Run SBML importer
4444
shell: bash
@@ -49,5 +49,5 @@ runs:
4949
shell: bash
5050
run: |
5151
cd cpp/build
52-
cmake -DCMAKE_BUILD_TYPE=Release -Dsbml_DIR=/usr/lib/x86_64-linux-gnu/cmake ..
52+
cmake -DCMAKE_BUILD_TYPE=Release -DMEMILIO_ENABLE_SBML=ON -Dsbml_DIR=/usr/lib/x86_64-linux-gnu/cmake ..
5353
cmake --build . -j 4

.github/pull_request_template.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ Please check our [git workflow](https://memilio.readthedocs.io/en/latest/develop
1818

1919
### Checks by code author
2020

21-
- [ ] Every addressed issue is linked (use the "Closes #ISSUE" keyword below)
22-
- [ ] New code adheres to [coding guidelines](https://memilio.readthedocs.io/en/latest/development.html#coding-guidelines)
23-
- [ ] No large data files have been added (files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
24-
- [ ] Tests are added for new functionality and a local test run was successful (with and without OpenMP)
25-
- [ ] Appropriate **documentation within the code** (Doxygen) for new functionality has been added in the code
26-
- [ ] Appropriate **external documentation** (ReadTheDocs) for new functionality has been added to the online documentation
27-
- [ ] Proper attention to licenses, especially no new third-party software with conflicting license has been added
21+
- [ ] Every addressed issue is linked (use the "Closes #ISSUE" keyword below).
22+
- [ ] New code adheres to [coding guidelines](https://memilio.readthedocs.io/en/latest/development.html#coding-guidelines).
23+
- [ ] No large data files have been added (files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.).
24+
- [ ] Tests are added for new functionality and a local test run was successful (with and without OpenMP).
25+
- [ ] Appropriate **documentation within the code** (Doxygen) for new functionality has been added in the code.
26+
- [ ] Appropriate **external documentation** (ReadTheDocs) for new functionality has been added to the online documentation and checked in the preview.
27+
- [ ] Proper attention to licenses, especially no new third-party software with conflicting license has been added.
2828
- [ ] (For ABM development) Checked [benchmark results](https://memilio.readthedocs.io/en/latest/development.html#agent-based-model-development) and ran and posted a local test above from before and after development to ensure performance is monitored.
2929

3030
### Checks by code reviewer(s)
3131

32-
- [ ] Corresponding issue(s) is/are linked and addressed
33-
- [ ] Code is clean of development artifacts (no deactivated or commented code lines, no debugging printouts, etc.)
34-
- [ ] Appropriate **unit tests** have been added, CI passes, code coverage and performance is acceptable (did not decrease)
35-
- [ ] No large data files added in the whole history of commits(files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.)
32+
- [ ] Corresponding issue(s) is/are linked and addressed.
33+
- [ ] Code is clean of development artifacts (no deactivated or commented code lines, no debugging printouts, etc.).
34+
- [ ] Appropriate **unit tests** have been added, CI passes, code coverage and performance is acceptable (did not decrease).
35+
- [ ] No large data files added in the whole history of commits(files should in sum not exceed 100 KB, avoid PDFs, Word docs, etc.).
3636
- [ ] On merge, add 2-5 lines with the changes (main added features, changed items, or corrected bugs) to the merge-commit-message. This can be taken from the **briefly-list-the-changes** above (best case) or the separate commit messages (worst case).

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ docs/html
282282
docs/xml
283283
docs/source/api
284284
docs/source/generated
285+
docs/source/cppapi
285286

286287
# VS Code
287288
.vscode/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs/doxygen-awesome-css"]
2+
path = docs/doxygen-awesome-css
3+
url = https://github.com/jothepro/doxygen-awesome-css.git

cpp/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ option(MEMILIO_BUILD_TESTS "Build memilio unit tests." ON)
99
option(MEMILIO_BUILD_EXAMPLES "Build memilio examples." ON)
1010
option(MEMILIO_BUILD_MODELS "Build memilio models." ON)
1111
option(MEMILIO_BUILD_BENCHMARKS "Build memilio benchmarks with google benchmark." OFF)
12-
option(MEMILIO_BUILD_SBML_MODELS "Build the SBML importer and imported models." ON)
1312
option(MEMILIO_USE_BUNDLED_SPDLOG "Use spdlog bundled with epi" ON)
1413
option(MEMILIO_USE_BUNDLED_EIGEN "Use eigen bundled with epi" ON)
1514
option(MEMILIO_USE_BUNDLED_BOOST "Use boost bundled with epi (only for epi-io)" ON)
@@ -20,6 +19,8 @@ option(MEMILIO_BUILD_SHARED_LIBS "Build memilio as a shared library." ON)
2019
option(MEMILIO_BUILD_STATIC_LIBS "Build memilio as a static library." ON)
2120
option(MEMILIO_ENABLE_MPI "Build memilio with MPI." OFF)
2221
option(MEMILIO_ENABLE_OPENMP "Enable Multithreading with OpenMP." OFF)
22+
option(MEMILIO_ENABLE_HDF5 "Build memilio with HDF5 IO support." ON)
23+
option(MEMILIO_ENABLE_SBML "Build memilio with the SBML importer and imported models." OFF)
2324
option(MEMILIO_ENABLE_WARNINGS "Build memilio with warnings." ON)
2425
option(MEMILIO_ENABLE_WARNINGS_AS_ERRORS "Build memilio with warnings as errors." ON)
2526
option(MEMILIO_ENABLE_IPOPT "Enable numerical optimization with Ipopt, requires a Fortran compiler." OFF)
@@ -210,7 +211,7 @@ if(MEMILIO_BUILD_BENCHMARKS)
210211
add_subdirectory(benchmarks)
211212
endif()
212213

213-
if(MEMILIO_BUILD_SBML_MODELS)
214+
if(MEMILIO_ENABLE_SBML)
214215
add_subdirectory(sbml_model_generation)
215216
endif()
216217

cpp/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ Options can be specified with `cmake .. -D<OPTION>=<VALUE>` or by editing the `b
5353
- `MEMILIO_BUILD_EXAMPLES`: build the example applications in the examples directory, ON or OFF, default ON.
5454
- `MEMILIO_BUILD_MODELS`: build the separate model libraries in the models directory, ON or OFF, default ON.
5555
- `MEMILIO_BUILD_SIMULATIONS`: build the simulation applications in the simulations directory, ON or OFF, default ON.
56-
- `MEMILIO_BUILD_SBML_MODELS`: build the SBML importer and imported models, i.e. everythin in the folder `sbml_model_generation`, ON or OFF, default ON.
5756
- `MEMILIO_USE_BUNDLED_SPDLOG/_BOOST/_EIGEN/_JSONCPP`: use the corresponding dependency bundled with this project, ON or OFF, default ON.
5857
- `MEMILIO_BUILD_BENCHMARKS`: build the benchmarks for this project, ON or OFF, default OFF.
5958
- `MEMILIO_SANITIZE_ADDRESS/_UNDEFINED`: compile with specified sanitizers to check correctness, ON or OFF, default OFF.
6059
- `MEMILIO_ENABLE_OPENMP`: compile MEmilio with multithreading using OpenMP, ON or OFF, default OFF.
6160
- `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.
61+
- `MEMILIO_ENABLE_HDF5`: build MEmilio with HDF5 IO support, ON or OFF, default ON. If OFF, HDF5 is not searched for and features like `save_result`/`read_result` are disabled.
62+
- `MEMILIO_ENABLE_SBML`: build the SBML importer and imported models, i.e. everythin in the folder `sbml_model_generation`, ON or OFF, default OFF.
6263
- `MEMILIO_ENABLE_WARNINGS`: enable compilation warnings (beyond those enabled in the compiler by default). ON or OFF, default ON.
6364
- `MEMILIO_ENABLE_WARNINGS_AS_ERRORS`: compilation warnings are treated as compilation errors. ON or OFF, default ON.
6465
- `MEMILIO_ENABLE_PROFILING`: compile with runtime profiling support. ON or OFF, default OFF. See [here](benchmarks/profiling.md) for information.

cpp/benchmarks/secir_ageres_setups.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace mio
3030
{
3131
namespace benchmark
3232
{
33-
namespace detail
33+
namespace details
3434
{
3535
/**
3636
* @brief Helper function to create a secir model with consistent setup for use in benchmarking.
@@ -89,7 +89,7 @@ mio::osecir::Model<ScalarType> make_model(int num)
8989

9090
return model;
9191
}
92-
} // namespace detail
92+
} // namespace details
9393

9494
namespace model
9595
{
@@ -98,7 +98,7 @@ namespace model
9898
*/
9999
mio::osecir::Model<ScalarType> SecirAgeres(size_t num_agegroups)
100100
{
101-
mio::osecir::Model<ScalarType> model = mio::benchmark::detail::make_model(num_agegroups);
101+
mio::osecir::Model<ScalarType> model = mio::benchmark::details::make_model(num_agegroups);
102102

103103
auto nb_groups = model.parameters.get_num_groups();
104104
ScalarType cont_freq = 10, fact = 1.0 / (ScalarType)(size_t)nb_groups;
@@ -117,7 +117,7 @@ mio::osecir::Model<ScalarType> SecirAgeres(size_t num_agegroups)
117117
*/
118118
mio::osecir::Model<ScalarType> SecirAgeresDampings(size_t num_agegroups)
119119
{
120-
mio::osecir::Model<ScalarType> model = mio::benchmark::detail::make_model(num_agegroups);
120+
mio::osecir::Model<ScalarType> model = mio::benchmark::details::make_model(num_agegroups);
121121

122122
auto nb_groups = model.parameters.get_num_groups();
123123
ScalarType cont_freq = 10, fact = 1.0 / (ScalarType)(size_t)nb_groups;
@@ -145,7 +145,7 @@ mio::osecir::Model<ScalarType> SecirAgeresDampings(size_t num_agegroups)
145145
*/
146146
mio::osecir::Model<ScalarType> SecirAgeresAbsurdDampings(size_t num_agegroups)
147147
{
148-
mio::osecir::Model<ScalarType> model = mio::benchmark::detail::make_model(num_agegroups);
148+
mio::osecir::Model<ScalarType> model = mio::benchmark::details::make_model(num_agegroups);
149149

150150
auto nb_groups = model.parameters.get_num_groups();
151151
ScalarType cont_freq = 10, fact = 1.0 / (ScalarType)(size_t)nb_groups;

cpp/memilio/ad/ad.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@
2727
#include <cmath>
2828
#include <limits>
2929

30+
namespace ad
31+
{
32+
namespace internal
33+
{
34+
35+
/**
36+
* @brief Format AD types (like ad::gt1s<double>::type) using their value for logging with spdlog.
37+
*
38+
* If derivative information is needed as well, use `ad::derivative(...)` or define a `fmt::formatter<...>`.
39+
*/
40+
template <class FP, class DataHandler>
41+
const FP& format_as(const active_type<FP, DataHandler>& ad_type)
42+
{
43+
// Note: the format_as function needs to be in the same namespace as the value it takes
44+
return value(ad_type);
45+
}
46+
47+
} // namespace internal
48+
} // namespace ad
49+
3050
// Allow std::numeric_limits to work with AD types.
3151
template <class FP, class DataHandler>
3252
struct std::numeric_limits<ad::internal::active_type<FP, DataHandler>> : public numeric_limits<FP> {

0 commit comments

Comments
 (0)