X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e18a7b043d161b29d0bf3f5743cb7a570241576a..c1194401ce4a41ff54a7591f4cf33c9ce2756978:/src/surf/network_smpi.cpp diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 9c6f3890da..9a14001b65 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -1,17 +1,13 @@ -/* Copyright (c) 2013-2017. 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. */ -#include -#include - -#include - #include "network_smpi.hpp" -#include "simgrid/sg_config.h" -#include "smpi/smpi_utils.hpp" +#include "simgrid/sg_config.hpp" +#include "smpi_utils.hpp" +#include "src/surf/surf_interface.hpp" +#include "surf/surf.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); @@ -37,25 +33,26 @@ void surf_network_model_init_SMPI() { if (surf_network_model) return; - surf_network_model = new simgrid::surf::NetworkSmpiModel(); - all_existing_models->push_back(surf_network_model); + surf_network_model = new simgrid::kernel::resource::NetworkSmpiModel(); - xbt_cfg_setdefault_double("network/weight-S", 8775); + simgrid::config::set_default("network/weight-S", 8775); } namespace simgrid { -namespace surf { +namespace kernel { +namespace resource { NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model() { + /* Do not add this into all_existing_models: our ancestor already does so */ } NetworkSmpiModel::~NetworkSmpiModel() = default; -double NetworkSmpiModel::bandwidthFactor(double size) +double NetworkSmpiModel::get_bandwidth_factor(double size) { if (smpi_bw_factor.empty()) - smpi_bw_factor = parse_factor(xbt_cfg_get_string("smpi/bw-factor")); + smpi_bw_factor = parse_factor(simgrid::config::get_value("smpi/bw-factor")); double current = 1.0; for (auto const& fact : smpi_bw_factor) { @@ -70,10 +67,10 @@ double NetworkSmpiModel::bandwidthFactor(double size) return current; } -double NetworkSmpiModel::latencyFactor(double size) +double NetworkSmpiModel::get_latency_factor(double size) { if (smpi_lat_factor.empty()) - smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor")); + smpi_lat_factor = parse_factor(simgrid::config::get_value("smpi/lat-factor")); double current = 1.0; for (auto const& fact : smpi_lat_factor) { @@ -88,9 +85,9 @@ double NetworkSmpiModel::latencyFactor(double size) return current; } -double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size) +double NetworkSmpiModel::get_bandwidth_constraint(double rate, double bound, double size) { - return rate < 0 ? bound : std::min(bound, rate * bandwidthFactor(size)); + return rate < 0 ? bound : std::min(bound, rate * get_bandwidth_factor(size)); } /************ @@ -102,3 +99,4 @@ double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double s **********/ } } +} // namespace simgrid