1 /* Copyright (c) 2013-2017. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "network_smpi.hpp"
13 #include "simgrid/sg_config.h"
14 #include "smpi_utils.hpp"
16 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
18 std::vector<s_smpi_factor_t> smpi_bw_factor;
19 std::vector<s_smpi_factor_t> smpi_lat_factor;
25 /************************************************************************/
26 /* New model based on LV08 and experimental results of MPI ping-pongs */
27 /************************************************************************/
28 /* @Inproceedings{smpi_ipdps, */
29 /* author={Pierre-Nicolas Clauss and Mark Stillwell and Stéphane Genaud and Frédéric Suter and Henri Casanova and Martin Quinson}, */
30 /* title={Single Node On-Line Simulation of {MPI} Applications with SMPI}, */
31 /* booktitle={25th IEEE International Parallel and Distributed Processing Symposium (IPDPS'11)}, */
32 /* address={Anchorage (Alaska) USA}, */
36 void surf_network_model_init_SMPI()
38 if (surf_network_model)
40 surf_network_model = new simgrid::surf::NetworkSmpiModel();
41 all_existing_models->push_back(surf_network_model);
43 xbt_cfg_setdefault_double("network/weight-S", 8775);
49 NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model()
53 NetworkSmpiModel::~NetworkSmpiModel() = default;
55 double NetworkSmpiModel::bandwidthFactor(double size)
57 if (smpi_bw_factor.empty())
58 smpi_bw_factor = parse_factor(xbt_cfg_get_string("smpi/bw-factor"));
61 for (auto const& fact : smpi_bw_factor) {
62 if (size <= fact.factor) {
63 XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
66 current = fact.values.front();
68 XBT_DEBUG("%f > %zu return %f", size, smpi_bw_factor.back().factor, current);
73 double NetworkSmpiModel::latencyFactor(double size)
75 if (smpi_lat_factor.empty())
76 smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor"));
79 for (auto const& fact : smpi_lat_factor) {
80 if (size <= fact.factor) {
81 XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
84 current = fact.values.front();
86 XBT_DEBUG("%f > %zu return %f", size, smpi_lat_factor.back().factor, current);
91 double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size)
93 return rate < 0 ? bound : std::min(bound, rate * bandwidthFactor(size));