SciCompMod / memilio

Modular spatio-temporal models for epidemic and pandemic simulations
https://scicompmod.github.io/memilio/
Apache License 2.0
53 stars 15 forks source link

Time measurement #17

Open elisabeth96 opened 3 years ago

elisabeth96 commented 3 years ago

In order to better detect bottlenecks or time consuming code parts, time measurement should be enabled / integrated. The question remains how we would like to do this. A simple option would be via OpenMP but this would be that it gets deactivated once the project is not build with OpenMP by a user.

Any better suggestions @dabele @joergbrech ?

(Text added by @mknaranja)

dabele commented 2 years ago

please add a description to what should be done/discussed.

mknaranja commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @dabele @elisabeth96 @joergbrech @reneSchm @mknaranja

dabele commented 2 years ago

I think this still needs refinement before we can estimate it.

The use case is not clear to me. Should it be just a simple stopwatch that can you can add to the code on demand during development, then immediately print the time? Or should it be something that is more advanced? Should it be able to collect multiple measurements and print at the end? Should it support scopes, similar to a profiler? should it be integrated with the logging system or is printing always ad-hoc using whatever way works for debugging? Should it be part of the code constantly, like logging, but deactivateable?

joergbrech commented 2 years ago

Would it make sense to add Google Benchmarks to our CMake Project, sort of like our unit tests?

mknaranja commented 2 years ago

I think that's another issue. We maybe want to have benchmarks in the future, but I also would like to offer time measurements in normal code execution (like examples), don't you?

mknaranja commented 1 year ago

Generally, we should run our algorithms many times in benchmark situations, in particular as for most algorithms execution time is small!

For further discussion, here is some nice short summary on this topic as first answer: https://stackoverflow.com/questions/20586661/what-should-i-check-cpu-time-or-wall-time or https://service.futurequest.net/index.php?/Knowledgebase/Article/View/407/0/difference-between-cpu-time-and-wall-time

Some notes on plain C++ time measurement:

https://www.geeksforgeeks.org/measure-execution-time-function-cpp/ https://iq.opengenus.org/measure-time-in-cpp/

For measuring wall-clock time with OpenMP:

https://www.openmp.org/spec-html/5.0/openmpsu160.html

dabele commented 9 months ago

Closed by #756

mknaranja commented 9 months ago

@dabele I am reopening the issue as (at least after some iterations) understood the issue as more general, i.e., to implement a timing scheme for all models that can be activated/deactivated or changed in granularity for all simulations.