Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the src and dst from the Link::on_communicate callback since it's now in the...
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 May 2020 16:29:42 +0000 (18:29 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 14 May 2020 18:13:15 +0000 (20:13 +0200)
include/simgrid/s4u/Link.hpp
src/plugins/host_dvfs.cpp
src/plugins/link_energy.cpp
src/s4u/s4u_Link.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/network_ib.cpp

index d5d13bb..89f4f79 100644 (file)
@@ -99,7 +99,7 @@ public:
   static xbt::signal<void(Link const&)> on_bandwidth_change;
 
   /** @brief Callback signal fired when a communication starts */
-  static xbt::signal<void(kernel::resource::NetworkAction&, Host* src, Host* dst)> on_communicate;
+  static xbt::signal<void(kernel::resource::NetworkAction&)> on_communicate;
 
   /** @brief Callback signal fired when a communication changes it state (ready/done/cancel) */
   static xbt::signal<void(kernel::resource::NetworkAction&, kernel::resource::Action::State)>
index 2232332..b46ed2d 100644 (file)
@@ -304,12 +304,11 @@ public:
     });
     // FIXME I think that this fires at the same time for all hosts, so when the src sends something,
     // the dst will be notified even though it didn't even arrive at the recv yet
-    simgrid::s4u::Link::on_communicate.connect(
-        [this](const kernel::resource::NetworkAction&, const s4u::Host* src, const s4u::Host* dst) {
-          if ((get_host() == src || get_host() == dst) && iteration_running) {
-            post_task();
-          }
-        });
+    simgrid::s4u::Link::on_communicate.connect([this](const kernel::resource::NetworkAction& act) {
+      if ((get_host() == &act.get_src() || get_host() == &act.get_dst()) && iteration_running) {
+        post_task();
+      }
+    });
   }
 
   std::string get_name() const override { return "Adagio"; }
index e75c128..4f076c0 100644 (file)
@@ -148,8 +148,7 @@ double LinkEnergy::get_consumed_energy()
 using simgrid::plugin::LinkEnergy;
 
 /* **************************** events  callback *************************** */
-static void on_communicate(const simgrid::kernel::resource::NetworkAction& action, const simgrid::s4u::Host*,
-                           const simgrid::s4u::Host*)
+static void on_communicate(const simgrid::kernel::resource::NetworkAction& action)
 {
   XBT_DEBUG("onCommunicate is called");
   for (simgrid::kernel::resource::LinkImpl* link : action.get_links()) {
index 4474227..bec2b9e 100644 (file)
@@ -23,7 +23,7 @@ xbt::signal<void(Link&)> Link::on_creation;
 xbt::signal<void(Link const&)> Link::on_destruction;
 xbt::signal<void(Link const&)> Link::on_state_change;
 xbt::signal<void(Link const&)> Link::on_bandwidth_change;
-xbt::signal<void(kernel::resource::NetworkAction&, Host* src, Host* dst)> Link::on_communicate;
+xbt::signal<void(kernel::resource::NetworkAction&)> Link::on_communicate;
 xbt::signal<void(kernel::resource::NetworkAction&, kernel::resource::Action::State)>
     Link::on_communication_state_change;
 
index 9f69a51..0e7d31b 100644 (file)
@@ -287,7 +287,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   }
   XBT_OUT();
 
-  simgrid::s4u::Link::on_communicate(*action, src, dst);
+  simgrid::s4u::Link::on_communicate(*action);
   return action;
 }
 
index 939ca95..0b7e322 100644 (file)
@@ -73,7 +73,7 @@ Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double
 {
   auto* action = new NetworkConstantAction(this, *src, *dst, size, sg_latency_factor);
 
-  s4u::Link::on_communicate(*action, src, dst);
+  s4u::Link::on_communicate(*action);
   return action;
 }
 
index 90cb7da..dfcaf91 100644 (file)
@@ -41,12 +41,11 @@ static void IB_action_state_changed_callback(simgrid::kernel::resource::NetworkA
   ((NetworkIBModel*)surf_network_model)->active_comms.erase(&action);
 }
 
-static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction& action, const simgrid::s4u::Host* src,
-                                    const simgrid::s4u::Host* dst)
+static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction& action)
 {
   simgrid::kernel::resource::NetworkIBModel* ibModel = (simgrid::kernel::resource::NetworkIBModel*)surf_network_model;
-  simgrid::kernel::resource::IBNode* act_src         = &ibModel->active_nodes.at(src->get_name());
-  simgrid::kernel::resource::IBNode* act_dst         = &ibModel->active_nodes.at(dst->get_name());
+  simgrid::kernel::resource::IBNode* act_src         = &ibModel->active_nodes.at(action.get_src().get_name());
+  simgrid::kernel::resource::IBNode* act_dst         = &ibModel->active_nodes.at(action.get_dst().get_name());
 
   ibModel->active_comms[&action] = std::make_pair(act_src, act_dst);
   ibModel->updateIBfactors(&action, act_src, act_dst, 0);