Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

511 Compute inflow and outflow of models #574

Merged
merged 120 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
2650152
[wip] first draft flows
HenrZu Jan 30, 2023
c297b3b
[wip] maybe new idea
HenrZu Feb 7, 2023
7d3529b
WIP flows
reneSchm Feb 9, 2023
67d0810
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Feb 9, 2023
88beb46
(re)implement Flows using compile time map
reneSchm Feb 9, 2023
2b51e91
flows ode_secir. agegroups for flows missing
HenrZu Feb 10, 2023
e7d488c
[wip] add support for AgeGroups etc. with Flows
reneSchm Feb 15, 2023
4a64f41
fix age groups. Secir now working
HenrZu Feb 16, 2023
c5f9abe
flows for secirvvs
HenrZu Feb 16, 2023
ec1421a
correct equations. Results now the same as before
HenrZu Feb 17, 2023
703b7d9
rm totalinfections and adjust test cases
HenrZu Feb 17, 2023
dc30031
wip integrate flows
HenrZu Feb 27, 2023
83849a3
add get_initial_flows
reneSchm Feb 27, 2023
992a3f7
first FlowSimulation implementation
reneSchm Feb 27, 2023
f018b9a
clean up
HenrZu Feb 28, 2023
3f14b3d
seir example with flows
HenrZu Mar 1, 2023
4d8c83e
Merge branch 'main' of github.com:DLR-SC/memilio into 511--Compute-in…
HenrZu Mar 3, 2023
d8ab993
fix tests after merge
HenrZu Mar 6, 2023
6a3435d
extend compartmentalmodel with flows to support more categories than …
reneSchm Mar 6, 2023
3d94f9a
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Mar 6, 2023
34036b9
add flatten_index_by_tags
reneSchm Mar 6, 2023
677a7d8
fix clang compiler error
reneSchm Mar 6, 2023
fc77d64
fix clang again
reneSchm Mar 6, 2023
7dad583
add flows test and correct ci error
HenrZu Mar 7, 2023
3b3b151
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Mar 9, 2023
9449e26
fix flow test result
reneSchm Mar 9, 2023
517e6f4
change flatten_index_by_tags, add comments to flow_chart.h, test get_…
reneSchm Mar 9, 2023
66c4ad7
fix get_initial_flows, extend flow tests
reneSchm Mar 9, 2023
3432d4b
fix test for msvc
reneSchm Mar 9, 2023
3139447
try to fix python generation test
reneSchm Mar 9, 2023
d49c265
remove maxDiff
reneSchm Mar 9, 2023
b4662f3
try to fix test
reneSchm Mar 9, 2023
36c7807
last fix
reneSchm Mar 9, 2023
64bf59f
decrease code complexity
reneSchm Mar 11, 2023
9d714c1
fix size initial flow
HenrZu Mar 14, 2023
347e888
(hopefully) final fix, new test.
HenrZu Mar 15, 2023
f3f33ff
review suggestions
HenrZu May 22, 2023
540df04
move metaprogramming functions
reneSchm May 25, 2023
5030fb9
add flow benchmarks
reneSchm May 25, 2023
0a58d5b
mitigate cpu scaling
reneSchm May 25, 2023
fe09278
temp disable clang format
HenrZu Jun 12, 2023
de191b6
manual formatting of flowcharts / comments
reneSchm Jun 12, 2023
4b2eaad
fix: clear results after each run
reneSchm Jun 12, 2023
5b888e4
add benchmark for seir
reneSchm Jun 12, 2023
38a7c5d
rm Total infections from plot file
HenrZu Jun 16, 2023
d4d465e
fix not setting integrator
reneSchm Jun 19, 2023
74bba22
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Jun 19, 2023
830d0b8
Merge branch 'main' of github.com:DLR-SC/memilio into 511--Compute-in…
HenrZu Jun 19, 2023
1304169
fix benchmarks
reneSchm Jun 19, 2023
c88c828
WIP renew constructor
HenrZu Jun 22, 2023
5e4a446
[WIP] add new Simulation
reneSchm Jun 22, 2023
9e7a2f8
Add SimulationFlows to benchmarks
reneSchm Jun 22, 2023
17f8447
reworked SimulationFlows
reneSchm Jun 26, 2023
6345136
even more verbose benchmark names
reneSchm Jun 26, 2023
dbad9a0
Apply suggestions from code review
HenrZu Jul 11, 2023
8338e41
review suggestion benchmarks
HenrZu Jul 13, 2023
002e612
Add documentation and other review suggestions
reneSchm Jul 13, 2023
050664f
add comments, remove FlowSimulation
reneSchm Jul 13, 2023
453d9ea
use the same namespace scopes
reneSchm Jul 13, 2023
3dcd80a
remove SplitOdeIntegrator
reneSchm Jul 13, 2023
588beec
move print_to_terminal to TimeSeries::print_table
reneSchm Jul 13, 2023
023cbe1
manually format flows
reneSchm Jul 13, 2023
482040c
fix tests, remove FlowSimulation from benchmarks
reneSchm Jul 13, 2023
23b7eb9
Review suggestions and documentation
reneSchm Jul 13, 2023
6c23c90
move new details closer to where they are needed
reneSchm Jul 13, 2023
c082ba4
add tests for set_ostream_format and print_table
HenrZu Jul 13, 2023
2fac351
some documentataion in benchmarks
HenrZu Jul 17, 2023
1932330
add flow severe to death
HenrZu Jul 17, 2023
d3deb16
ts test intial time points
HenrZu Jul 18, 2023
d5fafd0
fix typo
HenrZu Jul 18, 2023
b55531d
adjust tests to fail when no flow H->D
HenrZu Jul 18, 2023
7ab6e5e
Apply suggestions from code review
HenrZu Jul 18, 2023
dab838d
some documentation
HenrZu Jul 18, 2023
256a1f3
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
HenrZu Jul 18, 2023
7a1631b
Update cpp/memilio/compartments/compartmentalmodel.h
HenrZu Jul 18, 2023
12c0af2
description right_hand_side
HenrZu Jul 24, 2023
7543105
extend SimulationFlows to work with mobility
reneSchm Aug 4, 2023
10b1d93
Merge branch '511--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Aug 4, 2023
a5874c8
Merge branch 'main' into 511--Compute-inflow-and-outflow-of-models
reneSchm Aug 4, 2023
3f73e76
test consistentcy graph sim + readme
HenrZu Aug 7, 2023
830f6a8
add compare data
HenrZu Aug 7, 2023
69cb85a
fix type in compare
HenrZu Aug 9, 2023
0d60ba8
update readme
reneSchm Aug 10, 2023
9a1bec5
improve coverage
reneSchm Aug 14, 2023
9825348
Merge branch 'main' of github.com:DLR-SC/memilio into 511--Compute-in…
HenrZu Aug 14, 2023
48de3a2
adapt compare bc changed CriticalPerSevere param
HenrZu Aug 14, 2023
db3226b
use constexpr for typechart
HenrZu Oct 10, 2023
1f055c8
adjust test
HenrZu Oct 10, 2023
356a9ea
update Flow struct to c++17
reneSchm Oct 17, 2023
7aae0e3
Add argument in TestModel constructor to set dimensions
reneSchm Oct 17, 2023
0bd8fcd
rename TypeChart to TypeList and add traits
reneSchm Oct 17, 2023
3be0079
change one & to && for readability
reneSchm Oct 20, 2023
9ef9a35
[wip] add typelist traits,
reneSchm Oct 20, 2023
82950f0
rename and move FlowModel
reneSchm Oct 26, 2023
78bf4f9
[wip] reorganize simulation/integrator
reneSchm Oct 30, 2023
6f04642
Merge branch 'main' of github.com:DLR-SC/memilio into 511--Compute-in…
HenrZu Oct 31, 2023
37e11e1
move FlowSimualtion to its own header
reneSchm Nov 3, 2023
6cc8572
heavy changes to FlowModel
reneSchm Nov 3, 2023
f11201d
fix ci and shifting fixing test to issue 815
HenrZu Nov 3, 2023
8109f64
Did the TODO
reneSchm Nov 3, 2023
f6c0c83
remove const qualifiers from private members
reneSchm Nov 3, 2023
ce37781
fix missing include
reneSchm Nov 3, 2023
8dda56e
Add info about FlowModel
reneSchm Nov 3, 2023
aba753f
Add small tests for reduce_index, MultiIndexRange
reneSchm Nov 3, 2023
d7b8791
Merge branch '510--Compute-inflow-and-outflow-of-models' of github.co…
reneSchm Nov 3, 2023
9020f86
duplicate include
reneSchm Nov 3, 2023
5e4fc82
fix types for msvc
reneSchm Nov 3, 2023
551a887
fix bindings for CompartmentalModel::*_constraints
reneSchm Nov 3, 2023
493cc66
print results generation
HenrZu Nov 4, 2023
a2ae456
fix generation test
HenrZu Nov 4, 2023
942a2d8
minor changes
HenrZu Nov 4, 2023
756362e
small changes, edit comments
reneSchm Nov 6, 2023
1899802
move multi_index.h
reneSchm Nov 6, 2023
d857f8e
add comments/documentation
reneSchm Nov 6, 2023
24ef15f
try excluding get_flows from coverage
reneSchm Nov 7, 2023
c87cf37
Change FlowModel from struct to class
reneSchm Nov 9, 2023
5a27e26
implement most review suggestions
reneSchm Nov 13, 2023
572a9de
rename MultiIndexRange to IndexRange,
reneSchm Nov 13, 2023
fc11792
move multi_index_range.h to index_range.h
reneSchm Nov 13, 2023
ae25cd2
add a test for extend_index
reneSchm Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ endif()

set_target_properties(benchmark PROPERTIES FOLDER "Extern")

add_executable(simulation_benchmark simulation.cpp)
target_link_libraries(simulation_benchmark PRIVATE memilio ode_secir benchmark::benchmark)

add_executable(integrator_step_benchmark integrator_step.cpp)
target_link_libraries(integrator_step_benchmark PRIVATE memilio ode_secir benchmark::benchmark)

add_executable(flow_simulation_ode_secirvvs_benchmark flow_simulation_ode_secirvvs.cpp)
target_link_libraries(flow_simulation_ode_secirvvs_benchmark PRIVATE memilio ode_secirvvs benchmark::benchmark)

add_executable(flow_simulation_ode_seir_benchmark flow_simulation_ode_seir.cpp)
target_link_libraries(flow_simulation_ode_seir_benchmark PRIVATE memilio ode_seir benchmark::benchmark)

add_executable(simulation_benchmark simulation.cpp)
target_link_libraries(simulation_benchmark PRIVATE memilio ode_secir benchmark::benchmark)
add_executable(graph_simulation_benchmark graph_simulation.cpp)
target_link_libraries(graph_simulation_benchmark PRIVATE memilio ode_secirvvs benchmark::benchmark)
target_link_libraries(graph_simulation_benchmark PRIVATE memilio ode_secirvvs benchmark::benchmark)
116 changes: 116 additions & 0 deletions cpp/benchmarks/flow_simulation_ode_secirvvs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright (C) 2020-2023 German Aerospace Center (DLR-SC)
*
* Authors: Rene Schmieding, Daniel Abele, Martin J. Kuehn
*
* Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "benchmarks/simulation.h"
#include "benchmarks/flow_simulation_ode_secirvvs.h"
#include "memilio/compartments/flow_simulation.h"
#include "memilio/compartments/simulation.h"
#include "ode_secirvvs/model.h"
#include <string>

const std::string config_path = "../../benchmarks/simulation.config";

// simulation without flows (not in Model definition and not calculated by Simulation)
void flowless_sim(::benchmark::State& state)
{
using Model = mio::benchmark::FlowlessModel;
// suppress non-critical messages
mio::set_log_level(mio::LogLevel::critical);
// load config
auto cfg = mio::benchmark::SimulationConfig::initialize(config_path);
// create model
Model model(cfg.num_agegroups);
mio::benchmark::setup_model(model);
// create simulation
std::shared_ptr<mio::IntegratorCore> I =
std::make_shared<mio::ControlledStepperWrapper<boost::numeric::odeint::runge_kutta_cash_karp54>>(
cfg.abs_tol, cfg.rel_tol, cfg.dt_min, cfg.dt_max);
// run benchmark
for (auto _ : state) {
// This code gets timed
mio::benchmark::Simulation<mio::Simulation<Model>> sim(model, cfg.t0, cfg.dt);
sim.set_integrator(I);
// run sim
sim.advance(cfg.t_max);
}
}

// simulation with flows (in Model definition, but NOT calculated by Simulation)
void flow_sim_comp_only(::benchmark::State& state)
{
using Model = mio::benchmark::FlowModel;
// suppress non-critical messages
mio::set_log_level(mio::LogLevel::critical);
// load config
auto cfg = mio::benchmark::SimulationConfig::initialize(config_path);
// create model
Model model(cfg.num_agegroups);
mio::benchmark::setup_model(model);
// create simulation
std::shared_ptr<mio::IntegratorCore> I =
std::make_shared<mio::ControlledStepperWrapper<boost::numeric::odeint::runge_kutta_cash_karp54>>(
cfg.abs_tol, cfg.rel_tol, cfg.dt_min, cfg.dt_max);
// run benchmark
for (auto _ : state) {
// This code gets timed
mio::osecirvvs::Simulation<mio::Simulation<Model>> sim(model, cfg.t0, cfg.dt);
sim.set_integrator(I);
// run sim
sim.advance(cfg.t_max);
}
}

// simulation with flows (in Model definition and calculated by Simulation)
void flow_sim(::benchmark::State& state)
{
using Model = mio::benchmark::FlowModel;
// suppress non-critical messages
mio::set_log_level(mio::LogLevel::critical);
// load config
auto cfg = mio::benchmark::SimulationConfig::initialize(config_path);
// create model
Model model(cfg.num_agegroups);
mio::benchmark::setup_model(model);
// create simulation
std::shared_ptr<mio::IntegratorCore> I =
std::make_shared<mio::ControlledStepperWrapper<boost::numeric::odeint::runge_kutta_cash_karp54>>(
cfg.abs_tol, cfg.rel_tol, cfg.dt_min, cfg.dt_max);
// run benchmark
for (auto _ : state) {
// This code gets timed
mio::osecirvvs::Simulation<mio::FlowSimulation<Model>> sim(model, cfg.t0, cfg.dt);
sim.set_integrator(I);
// run sim
sim.advance(cfg.t_max);
}
}

// register functions as a benchmarks and set a name
// mitigate influence of cpu scaling
BENCHMARK(flowless_sim)->Name("Dummy 1/3");
BENCHMARK(flowless_sim)->Name("Dummy 2/3");
BENCHMARK(flowless_sim)->Name("Dummy 3/3");
// actual benchmarks
BENCHMARK(flowless_sim)
->Name(
"osecirvvs::Simulation<mio::Simulation> on osecirvvs::Model (osecirvvs::* from pre 511 branch) without flows");
BENCHMARK(flow_sim_comp_only)->Name("osecirvvs::Simulation<mio::Simulation> on osecirvvs::Model with flows");
BENCHMARK(flow_sim)->Name("osecirvvs::Simulation<mio::FlowSimulation> on osecirvvs::Model with flows");
// run all benchmarks
BENCHMARK_MAIN();
Loading