/** @brief Get the maxmin system of the current Model */
lmm::System* get_maxmin_system() const { return maxmin_system_; }
+ /** @brief Set the maxmin system of the current Model */
+ void set_maxmin_system(lmm::System* system) { maxmin_system_ = system; }
+
/**
* @brief Get the update mechanism of the current Model
* @see e_UM_t
*/
virtual bool nextOccuringEventIsIdempotent() { return true; }
-protected:
- lmm::System* maxmin_system_ = nullptr;
-
private:
+ lmm::System* maxmin_system_ = nullptr;
e_UM_t update_mechanism_ = UM_UNDEFINED;
Action::StateSet* ready_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */
Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */
StorageModel::StorageModel() : Model()
{
- maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
+ set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
}
StorageModel::~StorageModel()
xbt_die("Unsupported optimization (%s) for this model", optim.c_str());
}
- maxmin_system_ = new simgrid::kernel::lmm::System(select);
+ set_maxmin_system(new simgrid::kernel::lmm::System(select));
if (getUpdateMechanism() == UM_LAZY)
- maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet();
+ get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
CpuCas01Model::~CpuCas01Model()
xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str());
}
- maxmin_system_ = new simgrid::kernel::lmm::System(select);
+ set_maxmin_system(new simgrid::kernel::lmm::System(select));
loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
if (getUpdateMechanism() == UM_LAZY)
- maxmin_system_->modified_set_ = new kernel::resource::Action::ModifiedSet();
+ get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
}
NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(kernel::lmm::System* self)) : NetworkCm02Model()
{
- maxmin_system_->solve_fun = specificSolveFun;
+ get_maxmin_system()->solve_fun = specificSolveFun;
}
LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
- return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxmin_system_);
+ return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
}
void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
// if I am wearing a latency hat
if (action->get_type() == kernel::resource::Action::Type::LATENCY) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
- maxmin_system_->update_variable_weight(action->get_variable(), action->weight_);
+ get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
action->heapRemove();
action->set_last_update();
action.latency_ = 0.0;
}
if (action.latency_ <= 0.0 && not action.is_suspended())
- maxmin_system_->update_variable_weight(action.get_variable(), action.weight_);
+ get_maxmin_system()->update_variable_weight(action.get_variable(), action.weight_);
}
if (TRACE_is_enabled()) {
int n = action.get_variable()->get_number_of_constraint();
constraints_per_variable += back_route.size();
if (action->latency_ > 0) {
- action->set_variable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable));
+ action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
if (getUpdateMechanism() == UM_LAZY) {
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update());
: kernel::resource::Action::Type::LATENCY);
}
} else
- action->set_variable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable));
+ action->set_variable(get_maxmin_system()->variable_new(action, 1.0, -1.0, constraints_per_variable));
if (action->rate_ < 0) {
- maxmin_system_->update_variable_bound(
+ get_maxmin_system()->update_variable_bound(
action->get_variable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
} else {
- maxmin_system_->update_variable_bound(action->get_variable(),
- (action->latCurrent_ > 0)
- ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
- : action->rate_);
+ get_maxmin_system()->update_variable_bound(action->get_variable(),
+ (action->latCurrent_ > 0)
+ ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
+ : action->rate_);
}
for (auto const& link : route)
- maxmin_system_->expand(link->constraint(), action->get_variable(), 1.0);
+ get_maxmin_system()->expand(link->constraint(), action->get_variable(), 1.0);
if (not back_route.empty()) { // sg_network_crosstraffic was activated
XBT_DEBUG("Crosstraffic active adding backward flow using 5%%");
for (auto const& link : back_route)
- maxmin_system_->expand(link->constraint(), action->get_variable(), .05);
+ get_maxmin_system()->expand(link->constraint(), action->get_variable(), .05);
// Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
// (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
*All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
(*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->get_bound(), (*it)->init_rate);
- maxmin_system_->update_variable_bound((*it)->action->get_variable(), penalized_bw);
+ get_maxmin_system()->update_variable_bound((*it)->action->get_variable(), penalized_bw);
} else {
XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id,
(*it)->action, penalized_bw, (*it)->init_rate);
namespace surf {
HostL07Model::HostL07Model() : HostModel() {
- maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
- maxmin_system_->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
- surf_network_model = new NetworkL07Model(this, maxmin_system_);
- surf_cpu_model_pm = new CpuL07Model(this, maxmin_system_);
+ set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
+ get_maxmin_system()->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
+ surf_network_model = new NetworkL07Model(this, get_maxmin_system());
+ surf_cpu_model_pm = new CpuL07Model(this, get_maxmin_system());
}
HostL07Model::~HostL07Model()
CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : CpuModel(), hostModel_(hmodel)
{
- maxmin_system_ = sys;
+ set_maxmin_system(sys);
}
CpuL07Model::~CpuL07Model()
{
- maxmin_system_ = nullptr;
+ set_maxmin_system(nullptr);
}
NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(), hostModel_(hmodel)
{
- maxmin_system_ = sys;
+ set_maxmin_system(sys);
loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
}
NetworkL07Model::~NetworkL07Model()
{
- maxmin_system_ = nullptr;
+ set_maxmin_system(nullptr);
}
double HostL07Model::next_occuring_event(double now)
}
if ((action.latency_ <= 0.0) && (action.is_suspended() == 0)) {
action.updateBound();
- maxmin_system_->update_variable_weight(action.get_variable(), 1.0);
+ get_maxmin_system()->update_variable_weight(action.get_variable(), 1.0);
}
}
XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(),
"property Bwrite, storage", type_id.c_str());
StorageImpl* storage =
- new StorageN11(this, id, maxmin_system_, Bread, Bwrite, type_id, content_name, storage_type->size, attach);
+ new StorageN11(this, id, get_maxmin_system(), Bread, Bwrite, type_id, content_name, storage_type->size, attach);
storageCreatedCallbacks(storage);
XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id.c_str(), type_id.c_str(),