Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / surf / network_ib.cpp
index 9c7a7ed..5d80bd8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2023. 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. */
@@ -45,9 +45,7 @@ void surf_network_model_init_IB()
   simgrid::config::set_default<double>("network/weight-S", 8775);
 }
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 void NetworkIBModel::IB_create_host_callback(s4u::Host const& host)
 {
@@ -80,7 +78,7 @@ void NetworkIBModel::IB_comm_start_callback(const activity::CommImpl& comm)
   ibModel->update_IB_factors(action, act_src, act_dst, 0);
 }
 
-NetworkIBModel::NetworkIBModel(const std::string& name) : NetworkSmpiModel(name)
+NetworkIBModel::NetworkIBModel(const std::string& name) : NetworkCm02Model(name)
 {
   std::string IB_factors_string = config::get_value<std::string>("smpi/IB-penalty-factors");
   std::vector<std::string> radical_elements;
@@ -129,8 +127,7 @@ void NetworkIBModel::compute_IB_factors(IBNode* root) const
   for (ActiveComm* comm : root->active_comms_up_) {
     // compute inbound penalty
     double my_penalty_in = 1.0;
-    int nb_comms         = comm->destination->nb_active_comms_down_; // total number of incoming comms
-    if (nb_comms != 1)
+    if (comm->destination->nb_active_comms_down_ != 1)                      // total number of incoming comms
       my_penalty_in = (comm->destination->active_comms_down_)[root]         // number of comm sent to dest by root node
                       * Be_ * comm->destination->active_comms_down_.size(); // number of different nodes sending to dest
 
@@ -184,9 +181,9 @@ void NetworkIBModel::update_IB_factors(NetworkAction* action, IBNode* from, IBNo
       to->active_comms_down_[from] -= 1;
 
     to->nb_active_comms_down_--;
-    auto it = std::find_if(begin(from->active_comms_up_), end(from->active_comms_up_),
-                           [action](const ActiveComm* comm) { return comm->action == action; });
-    if (it != std::end(from->active_comms_up_)) {
+    if (auto it = std::find_if(begin(from->active_comms_up_), end(from->active_comms_up_),
+                               [action](const ActiveComm* comm) { return comm->action == action; });
+        it != std::end(from->active_comms_up_)) {
       delete *it;
       from->active_comms_up_.erase(it);
     }
@@ -206,6 +203,4 @@ void NetworkIBModel::update_IB_factors(NetworkAction* action, IBNode* from, IBNo
   update_IB_factors_rec(from, updated);
   XBT_DEBUG("IB - Finished updating %d", from->id_);
 }
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource