Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename enqueue_execs into enqueue_firings
authorFred Suter <suterf@ornl.gov>
Wed, 21 Jun 2023 18:54:17 +0000 (14:54 -0400)
committerFred Suter <suterf@ornl.gov>
Wed, 21 Jun 2023 18:59:45 +0000 (14:59 -0400)
12 files changed:
examples/cpp/task-io/s4u-task-io.cpp
examples/cpp/task-simple/s4u-task-simple.cpp
examples/cpp/task-storm/s4u-task-storm.cpp
examples/cpp/task-switch-host/s4u-task-switch-host.cpp
examples/cpp/task-variable-load/s4u-task-variable-load.cpp
examples/python/task-io/task-io.py
examples/python/task-simple/task-simple.py
examples/python/task-switch-host/task-switch-host.py
examples/python/task-variable-load/task-variable-load.py
include/simgrid/s4u/Task.hpp
src/bindings/python/simgrid_python.cpp
src/s4u/s4u_Task.cpp

index 52dcca1..f5d3c15 100644 (file)
@@ -45,8 +45,8 @@ int main(int argc, char* argv[])
     XBT_INFO("Task %s finished (%d)", t->get_name().c_str(), t->get_count());
   });
 
-  // Enqueue two executions for task exec1
-  exec1->enqueue_execs(2);
+  // Enqueue two firings for task exec1
+  exec1->enqueue_firings(2);
 
   // Start the simulation
   e.run();
index 0ec6aaa..72ddf4c 100644 (file)
@@ -42,8 +42,8 @@ int main(int argc, char* argv[])
     XBT_INFO("Task %s finished (%d)", t->get_name().c_str(), t->get_count());
   });
 
-  // Enqueue two executions for task exec1
-  exec1->enqueue_execs(2);
+  // Enqueue two firings for task exec1
+  exec1->enqueue_firings(2);
 
   // Start the simulation
   e.run();
index 63c3d64..2c4edb1 100644 (file)
@@ -114,9 +114,9 @@ int main(int argc, char* argv[])
     t->set_amount(*data * 10);
   });
 
-  // Enqueue executions for tasks without predecessors
-  SA->enqueue_execs(5);
-  SB->enqueue_execs(5);
+  // Enqueue firings for tasks without predecessors
+  SA->enqueue_firings(5);
+  SB->enqueue_firings(5);
 
   // Add a function to be called when tasks end for log purpose
   sg4::Task::on_completion_cb([]
index 2a22323..7023f68 100644 (file)
@@ -50,7 +50,7 @@ int main(int argc, char* argv[])
     XBT_INFO("Task %s finished (%d)", t->get_name().c_str(), t->get_count());
   });
 
-  // Add a function to be called before each executions of comm0
+  // Add a function to be called before each firing of comm0
   // This function modifies the graph of tasks by adding or removing
   // successors to comm0
   comm0->on_this_start_cb([comm0, exec1, exec2, jupiter, fafard](sg4::Task*) {
@@ -67,8 +67,8 @@ int main(int argc, char* argv[])
     count++;
   });
 
-  // Enqueue four executions for task comm0
-  comm0->enqueue_execs(4);
+  // Enqueue four firings for task comm0
+  comm0->enqueue_firings(4);
 
   // Start the simulation
   e.run();
index df41c95..0955c2e 100644 (file)
@@ -22,13 +22,13 @@ static void variable_load(sg4::TaskPtr t)
 {
   XBT_INFO("--- Small load ---");
   for (int i = 0; i < 3; i++) {
-    t->enqueue_execs(1);
+    t->enqueue_firings(1);
     sg4::this_actor::sleep_for(100);
   }
   sg4::this_actor::sleep_until(1000);
   XBT_INFO("--- Heavy load ---");
   for (int i = 0; i < 3; i++) {
-    t->enqueue_execs(1);
+    t->enqueue_firings(1);
     sg4::this_actor::sleep_for(1);
   }
 }
index 4db1456..e75215a 100644 (file)
@@ -43,8 +43,8 @@ if __name__ == '__main__':
     # Add a function to be called when tasks end for log purpose
     Task.on_completion_cb(callback)
 
-    # Enqueue two executions for task exec1
-    exec1.enqueue_execs(2)
+    # Enqueue two firings for task exec1
+    exec1.enqueue_firings(2)
 
     # runs the simulation
     e.run()
index ce57577..23e9fc0 100644 (file)
@@ -51,8 +51,8 @@ if __name__ == '__main__':
     # Add a function to be called when tasks end for log purpose
     Task.on_completion_cb(callback)
 
-    # Enqueue two executions for task exec1
-    exec1.enqueue_execs(2)
+    # Enqueue two firings for task exec1
+    exec1.enqueue_firings(2)
 
     # runs the simulation
     e.run()
index 53ba3f2..b2904c3 100644 (file)
@@ -77,13 +77,13 @@ if __name__ == '__main__':
     # Add a function to be called when tasks end for log purpose
     Task.on_completion_cb(callback)
 
-    # Add a function to be called before each executions of comm0
+    # Add a function to be called before each firing of comm0
     # This function modifies the graph of tasks by adding or removing
     # successors to comm0
     comm0.on_this_start_cb(lambda t: switch(t, [jupiter, fafard], [exec1,exec2]))
 
-    # Enqueue two executions for task exec1
-    comm0.enqueue_execs(4)
+    # Enqueue two firings for task exec1
+    comm0.enqueue_firings(4)
 
     # runs the simulation
     e.run()
index 719bf56..51dbc1a 100644 (file)
@@ -33,12 +33,12 @@ def callback(t):
 def variable_load(t):
     print('--- Small load ---')
     for _ in range(3):
-        t.enqueue_execs(1)
+        t.enqueue_firings(1)
         this_actor.sleep_for(100)
     this_actor.sleep_for(1000)
     print('--- Heavy load ---')
     for _ in range(3):
-        t.enqueue_execs(1)
+        t.enqueue_firings(1)
         this_actor.sleep_for(1)
 
 if __name__ == '__main__':
index d6f41f5..c0677da 100644 (file)
@@ -29,7 +29,7 @@ class XBT_PUBLIC Token : public xbt::Extendable<Token> {};
 class Task {
   std::string name_;
   double amount_;
-  int queued_execs_ = 0;
+  int queued_firings_ = 0;
   int count_        = 0;
   bool working_     = false;
 
@@ -74,7 +74,7 @@ public:
   void remove_all_successors();
   const std::set<Task*>& get_successors() const { return successors_; }
 
-  void enqueue_execs(int n);
+  void enqueue_firings(int n);
 
   /** Add a callback fired before this task activity starts */
   void on_this_start_cb(const std::function<void(Task*)>& func){ on_this_start.connect(func); }
index f7f06b7..f71d652 100644 (file)
@@ -947,8 +947,8 @@ PYBIND11_MODULE(simgrid, m)
       .def_property_readonly("count", &Task::get_count, "The execution count of this task (read-only).")
       .def_property_readonly("successors", &Task::get_successors, "The successors of this task (read-only).")
       .def_property("amount", &Task::get_amount, &Task::set_amount, "The amount of work to do for this task.")
-      .def("enqueue_execs", py::overload_cast<int>(&Task::enqueue_execs), py::call_guard<py::gil_scoped_release>(),
-           py::arg("n"), "Enqueue executions for this task.")
+      .def("enqueue_firings", py::overload_cast<int>(&Task::enqueue_firings), py::call_guard<py::gil_scoped_release>(),
+           py::arg("n"), "Enqueue firings for this task.")
       .def("add_successor", py::overload_cast<TaskPtr>(&Task::add_successor), py::call_guard<py::gil_scoped_release>(),
            py::arg("op"), "Add a successor to this task.")
       .def("remove_successor", py::overload_cast<TaskPtr>(&Task::remove_successor),
index 9c9fbe9..bda7ec1 100644 (file)
@@ -33,7 +33,7 @@ Task::Task(const std::string& name) : name_(name) {}
  */
 bool Task::ready_to_run() const
 {
-  return not working_ && queued_execs_ > 0;
+  return not working_ && queued_firings_ > 0;
 }
 
 /**
@@ -46,9 +46,9 @@ void Task::receive(Task* source)
 {
   XBT_DEBUG("Task %s received a token from %s", name_.c_str(), source->name_.c_str());
   auto source_count = predecessors_[source]++;
-  if (tokens_received_.size() <= queued_execs_ + source_count)
+  if (tokens_received_.size() <= queued_firings_ + source_count)
     tokens_received_.push_back({});
-  tokens_received_[queued_execs_ + source_count][source] = source->token_;
+  tokens_received_[queued_firings_ + source_count][source] = source->token_;
   bool enough_tokens = true;
   for (auto const& [key, val] : predecessors_)
     if (val < 1) {
@@ -58,7 +58,7 @@ void Task::receive(Task* source)
   if (enough_tokens) {
     for (auto& [key, val] : predecessors_)
       val--;
-    enqueue_execs(1);
+    enqueue_firings(1);
   }
 }
 
@@ -86,14 +86,14 @@ void Task::complete()
     fire();
 }
 
-/** @param n The number of executions to enqueue.
- *  @brief Enqueue executions.
- *  @note Immediatly starts an execution if possible.
+/** @param n The number of firings to enqueue.
+ *  @brief Enqueue firing.
+ *  @note Immediatly fire an activity if possible.
  */
-void Task::enqueue_execs(int n)
+void Task::enqueue_firings(int n)
 {
   simgrid::kernel::actor::simcall_answered([this, n] {
-    queued_execs_ += n;
+    queued_firings_ += n;
     if (ready_to_run())
       fire();
   });
@@ -129,7 +129,7 @@ void Task::fire() {
   on_this_start(this);
   on_start(this);
   working_ = true;
-  queued_execs_ = std::max(queued_execs_ - 1, 0);
+  queued_firings_ = std::max(queued_firings_ - 1, 0);
   if (tokens_received_.size() > 0)
     tokens_received_.pop_front();
 }