A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tiny doc update and cosmetics
[simgrid.git]
/
src
/
surf
/
network_cm02.cpp
diff --git
a/src/surf/network_cm02.cpp
b/src/surf/network_cm02.cpp
index
1282315
..
2a867cf
100644
(file)
--- a/
src/surf/network_cm02.cpp
+++ b/
src/surf/network_cm02.cpp
@@
-1,5
+1,4
@@
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-8,7
+7,7
@@
#include "maxmin_private.hpp"
#include "network_cm02.hpp"
#include "maxmin_private.hpp"
#include "network_cm02.hpp"
-#include "simgrid/s4u/
h
ost.hpp"
+#include "simgrid/s4u/
H
ost.hpp"
#include "simgrid/sg_config.h"
#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
#include "simgrid/sg_config.h"
#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
@@
-89,7
+88,7
@@
void surf_network_model_init_Reno()
if (surf_network_model)
return;
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(
&
lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
@@
-105,7
+104,7
@@
void surf_network_model_init_Reno2()
if (surf_network_model)
return;
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(
&
lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi);
@@
-120,7
+119,7
@@
void surf_network_model_init_Vegas()
if (surf_network_model)
return;
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
+ surf_network_model = new simgrid::surf::NetworkCm02Model(
&
lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
@@
-139,10
+138,10
@@
NetworkCm02Model::NetworkCm02Model()
char *optim = xbt_cfg_get_string("network/optim");
bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
char *optim = xbt_cfg_get_string("network/optim");
bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
- if (
!
strcmp(optim, "Full")) {
+ if (
not
strcmp(optim, "Full")) {
updateMechanism_ = UM_FULL;
selectiveUpdate_ = select;
updateMechanism_ = UM_FULL;
selectiveUpdate_ = select;
- } else if (
!
strcmp(optim, "Lazy")) {
+ } else if (
not
strcmp(optim, "Lazy")) {
updateMechanism_ = UM_LAZY;
selectiveUpdate_ = true;
xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
updateMechanism_ = UM_LAZY;
selectiveUpdate_ = true;
xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
@@
-167,9
+166,6
@@
NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self))
maxminSystem_->solve_fun = specificSolveFun;
}
maxminSystem_->solve_fun = specificSolveFun;
}
-
-NetworkCm02Model::~NetworkCm02Model() {}
-
LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
@@
-238,7
+234,7
@@
void NetworkCm02Model::updateActionsStateFull(double now, double delta)
double_update(&(deltap), action->latency_, sg_surf_precision);
action->latency_ = 0.0;
}
double_update(&(deltap), action->latency_, sg_surf_precision);
action->latency_ = 0.0;
}
- if (action->latency_
== 0.0 && !(action->isSuspended()
))
+ if (action->latency_
<= 0.0 && not action->isSuspended(
))
lmm_update_variable_weight(maxminSystem_, action->getVariable(), action->weight_);
}
if (TRACE_is_enabled()) {
lmm_update_variable_weight(maxminSystem_, action->getVariable(), action->weight_);
}
if (TRACE_is_enabled()) {
@@
-253,18
+249,17
@@
void NetworkCm02Model::updateActionsStateFull(double now, double delta)
action->getLastUpdate(), now - action->getLastUpdate());
}
}
action->getLastUpdate(), now - action->getLastUpdate());
}
}
- if (!lmm_get_number_of_cnst_from_var (maxminSystem_, action->getVariable())) {
- /* There is actually no link used, hence an infinite bandwidth.
- * This happens often when using models like vivaldi.
- * In such case, just make sure that the action completes immediately.
+ if (not lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable())) {
+ /* There is actually no link used, hence an infinite bandwidth. This happens often when using models like
+ * vivaldi. In such case, just make sure that the action completes immediately.
*/
action->updateRemains(action->getRemains());
}
action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
*/
action->updateRemains(action->getRemains());
}
action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
-
- if (action->getMaxDuration()
!=
NO_MAX_DURATION)
+
+ if (action->getMaxDuration()
>
NO_MAX_DURATION)
action->updateMaxDuration(delta);
action->updateMaxDuration(delta);
-
+
if (((action->getRemains() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) ||
((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
action->finish();
if (((action->getRemains() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) ||
((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
action->finish();
@@
-284,7
+279,7
@@
Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
src->routeTo(dst, route, &latency);
XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
src->routeTo(dst, route, &latency);
- xbt_assert(
!
route->empty() || 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());
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
src->cname(), dst->cname());
@@
-323,7
+318,7
@@
Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
action->latency_ *= latencyFactor(size);
action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size);
if (haveGap_) {
action->latency_ *= latencyFactor(size);
action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size);
if (haveGap_) {
- xbt_assert(
!
route->empty(),
+ 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);
"Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
gapAppend(size, route->at(0), action);
@@
-395,9
+390,8
@@
NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, doub
simgrid::s4u::Link::onCreation(this->piface_);
}
simgrid::s4u::Link::onCreation(this->piface_);
}
-void NetworkCm02Link::apply_event(tmgr_trace_
iterator
_t triggered, double value)
+void NetworkCm02Link::apply_event(tmgr_trace_
event
_t triggered, double value)
{
{
-
/* Find out which of my iterators was triggered, and react accordingly */
if (triggered == bandwidth_.event) {
setBandwidth(value);
/* Find out which of my iterators was triggered, and react accordingly */
if (triggered == bandwidth_.event) {
setBandwidth(value);
@@
-453,7
+447,7
@@
void NetworkCm02Link::setBandwidth(double value)
while ((var = lmm_get_var_from_cnst_safe(model()->getMaxminSystem(), constraint(), &elem, &nextelem, &numelem))) {
NetworkCm02Action *action = static_cast<NetworkCm02Action*>(lmm_variable_id(var));
action->weight_ += delta;
while ((var = lmm_get_var_from_cnst_safe(model()->getMaxminSystem(), constraint(), &elem, &nextelem, &numelem))) {
NetworkCm02Action *action = static_cast<NetworkCm02Action*>(lmm_variable_id(var));
action->weight_ += delta;
- if (
!
action->isSuspended())
+ if (
not
action->isSuspended())
lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
}
}
lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
}
}
@@
-486,19
+480,15
@@
void NetworkCm02Link::setLatency(double value)
XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
}
}
XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
}
}
- if (
!
action->isSuspended())
+ if (
not
action->isSuspended())
lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
}
}
lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
}
}
-NetworkCm02Link::~NetworkCm02Link() {}
-
/**********
* Action *
**********/
/**********
* Action *
**********/
-NetworkCm02Action::~NetworkCm02Action() {}
-
void NetworkCm02Action::updateRemainingLazy(double now)
{
if (suspended_ != 0)
void NetworkCm02Action::updateRemainingLazy(double now)
{
if (suspended_ != 0)
@@
-513,11
+503,11
@@
void NetworkCm02Action::updateRemainingLazy(double now)
XBT_DEBUG("Updating action(%p): remains is now %f", this, remains_);
}
XBT_DEBUG("Updating action(%p): remains is now %f", this, remains_);
}
- if (maxDuration_
!=
NO_MAX_DURATION)
+ if (maxDuration_
>
NO_MAX_DURATION)
double_update(&maxDuration_, delta, sg_surf_precision);
if ((remains_ <= 0 && (lmm_get_variable_weight(getVariable()) > 0)) ||
double_update(&maxDuration_, delta, sg_surf_precision);
if ((remains_ <= 0 && (lmm_get_variable_weight(getVariable()) > 0)) ||
- ((
(maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))))
{
+ ((
maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0)))
{
finish();
setState(Action::State::done);
heapRemove(getModel()->getActionHeap());
finish();
setState(Action::State::done);
heapRemove(getModel()->getActionHeap());