Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Little Sonar things.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Mar 2022 20:07:56 +0000 (22:07 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 31 Mar 2022 20:07:56 +0000 (22:07 +0200)
examples/python/comm-serialize/comm-serialize.py
src/bindings/python/simgrid_python.cpp
src/kernel/lmm/System.cpp

index e02708f..f3e8ef1 100644 (file)
@@ -46,7 +46,7 @@ class Receiver(object):
         # List in which we store all incoming msgs
         pending_comms: List[Tuple[Comm, PyGetAsync]] = []
         this_actor.info(f"Wait for {self.messages_count} messages asynchronously")
-        for i in range(self.messages_count):
+        for _ in range(self.messages_count):
             pending_comms.append(self.mailbox.get_async())
         while pending_comms:
             index = Comm.wait_any([comm for (comm, _) in pending_comms])
index 78f34a2..4b09a55 100644 (file)
@@ -722,7 +722,7 @@ PYBIND11_MODULE(simgrid, m)
                              "Retrieve the mailbox on which this comm acts.")
       .def_property_readonly("sender", &Comm::get_sender,
                              py::call_guard<py::gil_scoped_release>())
-      .def_property_readonly("state_str", [](Comm* self){ return std::string(self->get_state_str()); },
+      .def_property_readonly("state_str", [](const Comm* self){ return std::string(self->get_state_str()); },
                              py::call_guard<py::gil_scoped_release>(),
                              "Retrieve the Comm state as string")
       .def_property_readonly("remaining",  &Comm::get_remaining,
index fcf84f3..7d80308 100644 (file)
@@ -277,10 +277,9 @@ void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
 
   auto elem_it =
       std::find_if(begin(var->cnsts_), end(var->cnsts_), [&cnst](Element const& x) { return x.constraint == cnst; });
-  if (elem_it != end(var->cnsts_)) {
+  if (elem_it != end(var->cnsts_) && var->sharing_penalty_ != 0.0) {
     /* before changing it, decreases concurrency on constraint, it'll be added back later */
-    if (var->sharing_penalty_ != 0.0)
-      elem_it->decrease_concurrency();
+    elem_it->decrease_concurrency();
   }
   Element& elem = elem_it != end(var->cnsts_) ? expand_add_to_elem(*elem_it, cnst, consumption_weight)
                                               : expand_create_elem(cnst, var, consumption_weight);