X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0facf52013684615c801816de974754778c9474a..38f246c4c46920a78ea0af8233449f402c178f04:/src/surf/network_smpi.cpp?ds=sidebyside diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 54772d2b74..4fcd646267 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -33,8 +33,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network); void surf_network_model_init_SMPI() { auto net_model = std::make_shared("Network_SMPI"); - simgrid::kernel::EngineImpl::get_instance()->add_model(net_model); - simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->set_network_model(net_model); + auto* engine = simgrid::kernel::EngineImpl::get_instance(); + engine->add_model(net_model); + engine->get_netzone_root()->set_network_model(net_model); simgrid::config::set_default("network/weight-S", 8775); } @@ -43,6 +44,22 @@ namespace simgrid { namespace kernel { namespace resource { +void NetworkSmpiModel::check_lat_factor_cb() +{ + if (not simgrid::config::is_default("smpi/lat-factor")) { + throw std::invalid_argument( + "NetworkModelIntf: Cannot mix network/latency-factor and callback configuration. Choose only one of them."); + } +} + +void NetworkSmpiModel::check_bw_factor_cb() +{ + if (not simgrid::config::is_default("smpi/bw-factor")) { + throw std::invalid_argument( + "NetworkModelIntf: Cannot mix network/bandwidth-factor and callback configuration. Choose only one of them."); + } +} + double NetworkSmpiModel::get_bandwidth_factor(double size) { static std::vector smpi_bw_factor; @@ -80,11 +97,6 @@ double NetworkSmpiModel::get_latency_factor(double size) return current; } - -double NetworkSmpiModel::get_bandwidth_constraint(double rate, double bound, double size) -{ - return rate < 0 ? bound : std::min(bound, rate * get_bandwidth_factor(size)); -} } // namespace resource } // namespace kernel } // namespace simgrid