Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename NetworkModelIntf into NetworkModelFactors
[simgrid.git] / src / surf / network_smpi.cpp
1 /* Copyright (c) 2013-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include <simgrid/kernel/routing/NetZoneImpl.hpp>
7 #include <simgrid/s4u/Engine.hpp>
8
9 #include "simgrid/sg_config.hpp"
10 #include "smpi_utils.hpp"
11 #include "src/kernel/EngineImpl.hpp"
12 #include "src/surf/network_smpi.hpp"
13
14 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
15
16 /*********
17  * Model *
18  *********/
19
20 /************************************************************************/
21 /* New model based on LV08 and experimental results of MPI ping-pongs   */
22 /************************************************************************/
23 /* @Inproceedings{smpi_ipdps, */
24 /*  author={Pierre-Nicolas Clauss and Mark Stillwell and Stéphane Genaud and Frédéric Suter and Henri Casanova and
25  * Martin Quinson}, */
26 /*  title={Single Node On-Line Simulation of {MPI} Applications with SMPI}, */
27 /*  booktitle={25th IEEE International Parallel and Distributed Processing Symposium (IPDPS'11)}, */
28 /*  address={Anchorage (Alaska) USA}, */
29 /*  month=may, */
30 /*  year={2011} */
31 /*  } */
32 void surf_network_model_init_SMPI()
33 {
34   auto net_model = std::make_shared<simgrid::kernel::resource::NetworkSmpiModel>("Network_SMPI");
35   auto* engine   = simgrid::kernel::EngineImpl::get_instance();
36   engine->add_model(net_model);
37   engine->get_netzone_root()->set_network_model(net_model);
38
39   simgrid::config::set_default<double>("network/weight-S", 8775);
40   simgrid::config::set_default<std::string>("network/bandwidth-factor",
41                                             "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;"
42                                             "1426:0.608902;732:0.341987;257:0.338112;0:0.812084");
43   simgrid::config::set_default<std::string>("network/latency-factor",
44                                             "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;"
45                                             "1426:1.61075;732:1.9503;257:1.95341;0:2.01467");
46 }
47
48 namespace simgrid::kernel::resource {
49
50 void NetworkSmpiModel::check_lat_factor_cb()
51 {
52   if (not simgrid::config::is_default("network/latency-factor")) {
53     throw std::invalid_argument(
54         "NetworkModelIntf: Cannot mix network/latency-factor and callback configuration. Choose only one of them.");
55   }
56 }
57
58 void NetworkSmpiModel::check_bw_factor_cb()
59 {
60   if (not simgrid::config::is_default("network/bandwidth-factor")) {
61     throw std::invalid_argument(
62         "NetworkModelIntf: Cannot mix network/bandwidth-factor and callback configuration. Choose only one of them.");
63   }
64 }
65
66 } // namespace simgrid::kernel::resource