-/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2019. 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. */
/* } */
void surf_network_model_init_LegrandVelho()
{
- if (surf_network_model)
- return;
+ xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
- all_existing_models->push_back(surf_network_model);
simgrid::config::set_default<double>("network/latency-factor", 13.01);
simgrid::config::set_default<double>("network/bandwidth-factor", 0.97);
/* } */
void surf_network_model_init_CM02()
{
- if (surf_network_model)
- return;
+ xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
simgrid::config::set_default<double>("network/latency-factor", 1.0);
simgrid::config::set_default<double>("network/bandwidth-factor", 1.0);
simgrid::config::set_default<double>("network/weight-S", 0.0);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
- all_existing_models->push_back(surf_network_model);
}
/***************************************************************************/
/* } */
void surf_network_model_init_Reno()
{
- if (surf_network_model)
- return;
+ xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
- using namespace simgrid::kernel;
+ namespace lmm = simgrid::kernel::lmm;
lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
simgrid::config::set_default<double>("network/latency-factor", 13.01);
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
}
void surf_network_model_init_Reno2()
{
- if (surf_network_model)
- return;
+ xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
- using namespace simgrid::kernel;
+ namespace lmm = simgrid::kernel::lmm;
lmm::Lagrange::set_default_protocol_function(lmm::func_reno2_f, lmm::func_reno2_fp, lmm::func_reno2_fpi);
simgrid::config::set_default<double>("network/latency-factor", 13.01);
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
}
void surf_network_model_init_Vegas()
{
- if (surf_network_model)
- return;
+ xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
- using namespace simgrid::kernel;
+ namespace lmm = simgrid::kernel::lmm;
lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
simgrid::config::set_default<double>("network/latency-factor", 13.01);
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
}
namespace simgrid {
: NetworkModel(simgrid::config::get_value<std::string>("network/optim") == "Full" ? Model::UpdateAlgo::FULL
: Model::UpdateAlgo::LAZY)
{
+ all_existing_models.push_back(this);
+
std::string optim = simgrid::config::get_value<std::string>("network/optim");
bool select = simgrid::config::get_value<bool>("network/maxmin-selective-update");
}
set_maxmin_system(make_new_lmm_system(select));
- loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE);
+ loopback_ = NetworkCm02Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE);
}
-LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
- s4u::Link::SharingPolicy policy)
+LinkImpl* NetworkCm02Model::create_link(const std::string& name, double bandwidth, double latency,
+ s4u::Link::SharingPolicy policy)
{
return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
}
XBT_IN("(%s,%s,%g,%g)", src->get_cname(), dst->get_cname(), size, rate);
src->route_to(dst, route, &latency);
- xbt_assert(not route.empty() || latency,
+ xbt_assert(not route.empty() || latency > 0,
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
src->get_cname(), dst->get_cname());
});
}
- double bandwidth_bound = route.empty() ? -1.0 : bandwidthFactor(size) * route.front()->get_bandwidth();
+ double bandwidth_bound = route.empty() ? -1.0 : get_bandwidth_factor(size) * route.front()->get_bandwidth();
for (auto const& link : route)
- bandwidth_bound = std::min(bandwidth_bound, bandwidthFactor(size) * link->get_bandwidth());
+ bandwidth_bound = std::min(bandwidth_bound, get_bandwidth_factor(size) * link->get_bandwidth());
action->lat_current_ = action->latency_;
- action->latency_ *= latencyFactor(size);
- action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size);
+ action->latency_ *= get_latency_factor(size);
+ action->rate_ = get_bandwidth_constraint(action->rate_, bandwidth_bound, size);
- int constraints_per_variable = route.size();
+ size_t constraints_per_variable = route.size();
constraints_per_variable += back_route.size();
if (action->latency_ > 0) {
simgrid::s4u::Link::on_creation(this->piface_);
}
-void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
+void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
{
/* Find out which of my iterators was triggered, and react accordingly */
if (triggered == bandwidth_.event) {