Skip to content

Trigger new engine solve upon host events such as host on/off

Fabien Chaix requested to merge chaix/simgrid:dev-cpuimpl-used into master

Previously, when an host was disabled or enabled, there might be a lag before effects are taken into account, as described in #110 (closed)

[This part is from memory so it might have some flaws] In practice, in EngineImpl, the solve loop tries to consume as many events from profiles as possible before actually advancing time (which is nice). How does the Engine know what event affect the system, and hence require the simulation time to actually advance ? Well, each Activity Impl has a used property that says whether it is doing stuff. When we have an event on a Host (e.g. turn it off), the engine checks out the used property of the corresponding CpuImpl. Currently, the used property is inherited from ActivityImpl, and checks whether there are Actions ongoing that are attached to this CpuImpl. Usually this is fine. But if we just have some wait_any or test_any, there is no ongoing Action, and the engine believes that the Host is doing nothing. Which is wrong. In most simulations, this would not have too much impact because the simulation time will have to stop soon anyway, but if events are infrequent, it is a problem IMHO.

This MR is implementing a brutal solution that assumes that a CPUImpl (~=Host) is always running some actions, and hence trigger a new Engine solve iteration.

There are certainly more elegant ways to address this issue, but it does not look trivial, and I think in practice this should not degrade performance too much.

Edited by Fabien Chaix

Merge request reports