X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c3119f83962a5b1ef7bc8f79011698c83ce21cda..82fd162ad0b5fc51a715b6e6e6df55bb52a18b44:/src/surf/network_cm02.cpp diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 4e6c8aad4f..d3e8809e05 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -13,7 +13,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); -double sg_sender_gap = 0.0; double sg_latency_factor = 1.0; /* default value; can be set by model or from command line */ double sg_bandwidth_factor = 1.0; /* default value; can be set by model or from command line */ double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */ @@ -166,7 +165,7 @@ NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self)) maxminSystem_->solve_fun = specificSolveFun; } -LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency, +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, maxminSystem_); @@ -205,11 +204,8 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) // assume that flows that reached max_duration have remaining of 0 XBT_DEBUG("Action %p finished", action); action->setRemains(0); - action->finish(); - action->setState(Action::State::done); + action->finish(Action::State::done); action->heapRemove(actionHeap_); - - action->gapRemove(); } } } @@ -262,9 +258,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) if (((action->getRemains() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) || ((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) { - action->finish(); - action->setState(Action::State::done); - action->gapRemove(); + action->finish(Action::State::done); } } } @@ -276,21 +270,21 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz std::vector* back_route = nullptr; std::vector* route = new std::vector(); - XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate); + XBT_IN("(%s,%s,%g,%g)", src->getCname(), dst->getCname(), size, rate); src->routeTo(dst, route, &latency); xbt_assert(not route->empty() || latency, "You're trying to send data from %s to %s but there is no connecting path between these two hosts.", - src->cname(), dst->cname()); + src->getCname(), dst->getCname()); - for (auto link: *route) + for (auto const& link : *route) if (link->isOff()) failed = 1; if (sg_network_crosstraffic == 1) { back_route = new std::vector(); dst->routeTo(src, back_route, nullptr); - for (auto link: *back_route) + for (auto const& link : *back_route) if (link->isOff()) failed = 1; } @@ -306,10 +300,10 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz double bandwidth_bound = -1.0; if (sg_weight_S_parameter > 0) - for (auto link : *route) + for (auto const& link : *route) action->weight_ += sg_weight_S_parameter / link->bandwidth(); - for (auto link : *route) { + for (auto const& link : *route) { double bb = bandwidthFactor(size) * link->bandwidth(); bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb); } @@ -317,14 +311,6 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz action->latCurrent_ = action->latency_; action->latency_ *= latencyFactor(size); action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size); - if (haveGap_) { - xbt_assert(not route->empty(), - "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!"); - - gapAppend(size, route->at(0), action); - XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->cname(), dst->cname(), action->senderGap_, - action->latency_); - } int constraints_per_variable = route->size(); if (back_route != nullptr) @@ -346,12 +332,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->latCurrent_ > 0) ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)) : action->rate_); } - for (auto link: *route) + for (auto const& link : *route) lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), 1.0); if (back_route != nullptr) { // sg_network_crosstraffic was activated XBT_DEBUG("Fullduplex active adding backward flow using 5%%"); - for (auto link : *back_route) + for (auto const& link : *back_route) lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), .05); //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency @@ -367,14 +353,10 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz return action; } -void NetworkCm02Model::gapAppend(double size, const LinkImpl* link, NetworkAction* action){ - // Nothing -}; - /************ * Resource * ************/ -NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency, +NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy, lmm_system_t system) : LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth)) { @@ -508,8 +490,7 @@ void NetworkCm02Action::updateRemainingLazy(double now) if ((remains_ <= 0 && (lmm_get_variable_weight(getVariable()) > 0)) || ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) { - finish(); - setState(Action::State::done); + finish(Action::State::done); heapRemove(getModel()->getActionHeap()); } @@ -517,8 +498,5 @@ void NetworkCm02Action::updateRemainingLazy(double now) lastValue_ = lmm_variable_getvalue(getVariable()); } -void NetworkCm02Link::gapAppend(double size, const LinkImpl* link, NetworkAction* action){ - // Nothing -}; } }