set_start_time(model_action_->get_start_time());
}
- /* Allow execs to fail if any their host fail (or any of their host for parallel execs) */
- cb_id_ = s4u::Host::on_state_change.connect([this](s4u::Host const& h) {
- if (not h.is_on() && get_state() == kernel::activity::State::RUNNING &&
- std::find(get_hosts().begin(), get_hosts().end(), &h) != get_hosts().end()) {
- set_state(kernel::activity::State::FAILED);
- finish();
- }
- });
-
XBT_DEBUG("Create execute synchro %p: %s", this, get_cname());
return this;
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/resource/CpuImpl.hpp"
+#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/models/cpu_ti.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/simgrid/math_utils.h"
Resource::seal();
}
+void CpuImpl::turn_off()
+{
+ if (is_on()) {
+ Resource::turn_off();
+
+ const kernel::lmm::Element* elem = nullptr;
+ double now = EngineImpl::get_clock();
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
+ Action* action = var->get_id();
+ if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
+ action->set_finish_time(now);
+ action->set_state(Action::State::FAILED);
+ }
+ }
+ }
+}
+
/**********
* Action *
**********/
CpuImpl* set_core_count(int core_count);
virtual int get_core_count() const { return core_count_; }
+ void turn_off() override;
+
bool is_used() const override { return true; }
void seal() override;
delete speed_integrated_trace_;
}
+void CpuTi::turn_off()
+{
+ /* Skip CpuImpl::turn_off() that marks the actions as failing, as it seems to be done otherwise in CPU TI.
+ * So, just avoid the segfault for now.
+ *
+ * TODO: a proper solution would be to understand and adapt the way actions are marked FAILED in here,
+ * and adapt it to align with the other resources. */
+ Resource::turn_off();
+}
+
CpuImpl* CpuTi::set_speed_profile(kernel::profile::Profile* profile)
{
delete speed_integrated_trace_;
~CpuTi() override;
CpuImpl* set_speed_profile(profile::Profile* profile) override;
+ void turn_off() override;
void apply_event(profile::Event* event, double value) override;
void update_actions_finish_time(double now);