From: Frederic Suter Date: Mon, 8 Mar 2021 21:54:49 +0000 (+0100) Subject: fix GH#343 X-Git-Tag: v3.27~208 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e1d5724a2ddeac3eaeb8d802c23f44e9dec13898 fix GH#343 - An exec that ends right when the timeout expires is actually done - when the timeout_detector finished, change the state of the action of the ExecImpl that owns this detector to FAILED. This will trigger on_state_change for the right action and solve the issue on energy logging of this issue. - Side effect, more instrumentation is displayed in another example of a ptask with timeout. --- diff --git a/ChangeLog b/ChangeLog index 3e1a6ae271..67accfc2fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ Documentation: Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests) (FG: issues on Framagit; GF: issues on GForge; GH: issues on GitHub) - FG#37: Parallel tasks are limited to 1 core per host +- GH#343: Wrong consumed energy when an exec timeouts ---------------------------------------------------------------------------- diff --git a/examples/cpp/exec-ptask/s4u-exec-ptask.tesh b/examples/cpp/exec-ptask/s4u-exec-ptask.tesh index b03213dfe9..3061414fcf 100644 --- a/examples/cpp/exec-ptask/s4u-exec-ptask.tesh +++ b/examples/cpp/exec-ptask/s4u-exec-ptask.tesh @@ -11,6 +11,10 @@ $ ${bindir:=.}/s4u-exec-ptask ${platfdir}/energy_platform.xml --cfg=host/model:p > [300.000000] (0:maestro@) UNCAT HOST [0.000000 - 300.000000] MyHost3 speed_used 3333333.333333 > [300.000000] (0:maestro@) UNCAT LINK [0.000000 - 300.000000] bus bandwidth_used 100000.000000 > [300.000000] (1:test@MyHost1) We can do the same with a timeout of 10 seconds enabled. +> [310.000000] (0:maestro@) UNCAT HOST [300.000000 - 310.000000] MyHost1 speed_used 3333333.333333 +> [310.000000] (0:maestro@) UNCAT HOST [300.000000 - 310.000000] MyHost2 speed_used 3333333.333333 +> [310.000000] (0:maestro@) UNCAT HOST [300.000000 - 310.000000] MyHost3 speed_used 3333333.333333 +> [310.000000] (0:maestro@) UNCAT LINK [300.000000 - 310.000000] bus bandwidth_used 100000.000000 > [310.000000] (1:test@MyHost1) Caught the expected timeout exception. > [310.000000] (1:test@MyHost1) Then, build a parallel activity involving only computations (of different amounts) and no communication > [320.000000] (0:maestro@) UNCAT HOST [310.000000 - 320.000000] MyHost1 speed_used 30000000.000000 diff --git a/src/kernel/activity/ExecImpl.cpp b/src/kernel/activity/ExecImpl.cpp index 0e380119ca..e643483b0a 100644 --- a/src/kernel/activity/ExecImpl.cpp +++ b/src/kernel/activity/ExecImpl.cpp @@ -161,7 +161,12 @@ void ExecImpl::post() /* If the host running the synchro didn't fail, then the synchro was canceled */ state_ = State::CANCELED; } else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED) { - state_ = State::TIMEOUT; + if (surf_action_->get_remains() > 0.0) { + surf_action_->set_state(resource::Action::State::FAILED); + state_ = State::TIMEOUT; + } else { + state_ = State::DONE; + } } else { state_ = State::DONE; }