A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update copyright lines for 2022.
[simgrid.git]
/
src
/
surf
/
network_smpi.cpp
diff --git
a/src/surf/network_smpi.cpp
b/src/surf/network_smpi.cpp
index
b559d23
..
36c8a85
100644
(file)
--- a/
src/surf/network_smpi.cpp
+++ b/
src/surf/network_smpi.cpp
@@
-1,22
+1,17
@@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2022. 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. */
/* 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 <
cstddef
>
-#include <
algorithm
>
+#include <
simgrid/kernel/routing/NetZoneImpl.hpp
>
+#include <
simgrid/s4u/Engine.hpp
>
-#include <xbt/log.h>
+#include "simgrid/sg_config.hpp"
+#include "smpi_utils.hpp"
+#include "src/kernel/EngineImpl.hpp"
+#include "src/surf/network_smpi.hpp"
-#include "network_smpi.hpp"
-#include "simgrid/sg_config.h"
-#include "smpi/smpi_utils.hpp"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
-
-std::vector<s_smpi_factor_t> smpi_bw_factor;
-std::vector<s_smpi_factor_t> smpi_lat_factor;
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
/*********
* Model *
/*********
* Model *
@@
-26,7
+21,8
@@
std::vector<s_smpi_factor_t> smpi_lat_factor;
/* New model based on LV08 and experimental results of MPI ping-pongs */
/************************************************************************/
/* @Inproceedings{smpi_ipdps, */
/* New model based on LV08 and experimental results of MPI ping-pongs */
/************************************************************************/
/* @Inproceedings{smpi_ipdps, */
-/* author={Pierre-Nicolas Clauss and Mark Stillwell and Stéphane Genaud and Frédéric Suter and Henri Casanova and Martin Quinson}, */
+/* author={Pierre-Nicolas Clauss and Mark Stillwell and Stéphane Genaud and Frédéric Suter and Henri Casanova and
+ * Martin Quinson}, */
/* title={Single Node On-Line Simulation of {MPI} Applications with SMPI}, */
/* booktitle={25th IEEE International Parallel and Distributed Processing Symposium (IPDPS'11)}, */
/* address={Anchorage (Alaska) USA}, */
/* title={Single Node On-Line Simulation of {MPI} Applications with SMPI}, */
/* booktitle={25th IEEE International Parallel and Distributed Processing Symposium (IPDPS'11)}, */
/* address={Anchorage (Alaska) USA}, */
@@
-35,30
+31,42
@@
std::vector<s_smpi_factor_t> smpi_lat_factor;
/* } */
void surf_network_model_init_SMPI()
{
/* } */
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);
+ auto net_model = std::make_shared<simgrid::kernel::resource::NetworkSmpiModel>("Network_SMPI");
+
auto* engine = simgrid::kernel::EngineImpl::get_instance()
;
+
engine->add_model(net_model
);
+
engine->get_netzone_root()->set_network_model(net
_model);
-
xbt_cfg_setdefault_double
("network/weight-S", 8775);
+
simgrid::config::set_default<double>
("network/weight-S", 8775);
}
namespace simgrid {
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
-
NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model
()
+
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.");
+ }
}
}
-NetworkSmpiModel::~NetworkSmpiModel() = default;
+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::
bandwidthF
actor(double size)
+double NetworkSmpiModel::
get_bandwidth_f
actor(double size)
{
{
+ static std::vector<s_smpi_factor_t> smpi_bw_factor;
if (smpi_bw_factor.empty())
if (smpi_bw_factor.empty())
- smpi_bw_factor =
parse_factor(xbt_cfg_get_string
("smpi/bw-factor"));
+ smpi_bw_factor =
smpi::utils::parse_factor(config::get_value<std::string>
("smpi/bw-factor"));
double current = 1.0;
double current = 1.0;
- for (
const auto
& fact : smpi_bw_factor) {
+ for (
auto const
& fact : smpi_bw_factor) {
if (size <= fact.factor) {
XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
return current;
if (size <= fact.factor) {
XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
return current;
@@
-70,13
+78,14
@@
double NetworkSmpiModel::bandwidthFactor(double size)
return current;
}
return current;
}
-double NetworkSmpiModel::
latencyF
actor(double size)
+double NetworkSmpiModel::
get_latency_f
actor(double size)
{
{
+ static std::vector<s_smpi_factor_t> smpi_lat_factor;
if (smpi_lat_factor.empty())
if (smpi_lat_factor.empty())
- smpi_lat_factor =
parse_factor(xbt_cfg_get_string
("smpi/lat-factor"));
+ smpi_lat_factor =
smpi::utils::parse_factor(config::get_value<std::string>
("smpi/lat-factor"));
double current = 1.0;
double current = 1.0;
- for (
const auto
& fact : smpi_lat_factor) {
+ for (
auto const
& fact : smpi_lat_factor) {
if (size <= fact.factor) {
XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
return current;
if (size <= fact.factor) {
XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
return current;
@@
-87,18
+96,6
@@
double NetworkSmpiModel::latencyFactor(double size)
return current;
}
return current;
}
-
-double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size)
-{
- return rate < 0 ? bound : std::min(bound, rate * bandwidthFactor(size));
-}
-
-/************
- * Resource *
- ************/
-
-/**********
- * Action *
- **********/
-}
-}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid