Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'wifi_clean' into 'master'
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 6 Oct 2022 19:07:17 +0000 (19:07 +0000)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 6 Oct 2022 19:07:17 +0000 (19:07 +0000)
Wi-Fi callback mechanism

See merge request simgrid/simgrid!118

1  2 
MANIFEST.in
src/kernel/lmm/System.cpp
src/kernel/lmm/System.hpp
src/surf/network_cm02.cpp
tools/cmake/DefinePackages.cmake

diff --combined MANIFEST.in
@@@ -316,8 -316,6 +316,8 @@@ include examples/cpp/mc-centralized-mut
  include examples/cpp/mc-centralized-mutex/s4u-mc-centralized-mutex.tesh
  include examples/cpp/mc-electric-fence/s4u-mc-electric-fence.cpp
  include examples/cpp/mc-electric-fence/s4u-mc-electric-fence.tesh
 +include examples/cpp/mc-failing-assert/s4u-mc-failing-assert-nodpor.tesh
 +include examples/cpp/mc-failing-assert/s4u-mc-failing-assert-statequality.tesh
  include examples/cpp/mc-failing-assert/s4u-mc-failing-assert.cpp
  include examples/cpp/mc-failing-assert/s4u-mc-failing-assert.tesh
  include examples/cpp/network-factors/s4u-network-factors.cpp
@@@ -559,8 -557,6 +559,8 @@@ include examples/python/exec-cpu-nonlin
  include examples/python/exec-cpu-nonlinear/exec-cpu-nonlinear.tesh
  include examples/python/exec-dvfs/exec-dvfs.py
  include examples/python/exec-dvfs/exec-dvfs.tesh
 +include examples/python/exec-ptask/exec-ptask.py
 +include examples/python/exec-ptask/exec-ptask.tesh
  include examples/python/exec-remote/exec-remote.py
  include examples/python/exec-remote/exec-remote.tesh
  include examples/python/io-degradation/io-degradation.py
@@@ -714,9 -710,6 +714,9 @@@ include examples/smpi/trace_call_locati
  include examples/smpi/trace_call_location/trace_call_location.tesh
  include examples/smpi/trace_simple/trace_simple.c
  include examples/smpi/trace_simple/trace_simple.tesh
 +include examples/sthread/pthread-mutex-simple.c
 +include examples/sthread/pthread-mutex-simple.tesh
 +include examples/sthread/sthread-mutex-simple.c
  include src/include/catch_simgrid.hpp
  include teshsuite/java/semaphoregc/SemaphoreGC.java
  include teshsuite/java/semaphoregc/semaphoregc.tesh
@@@ -940,6 -933,7 +940,6 @@@ include teshsuite/smpi/coll-allreduce/c
  include teshsuite/smpi/coll-alltoall/clusters.tesh
  include teshsuite/smpi/coll-alltoall/coll-alltoall.c
  include teshsuite/smpi/coll-alltoall/coll-alltoall.tesh
 -include teshsuite/smpi/coll-alltoall/griffon.tesh
  include teshsuite/smpi/coll-alltoallv/coll-alltoallv.c
  include teshsuite/smpi/coll-alltoallv/coll-alltoallv.tesh
  include teshsuite/smpi/coll-barrier/coll-barrier.c
@@@ -1967,6 -1961,7 +1967,7 @@@ include examples/platforms/two_peers.xm
  include examples/platforms/vivaldi.xml
  include examples/platforms/wifi.xml
  include examples/platforms/wifi_energy.xml
+ include examples/platforms/wifi_large_cell.xml
  include examples/platforms/wifi_ns3.xml
  include examples/python/CMakeLists.txt
  include examples/python/actor-create/actor-create_d.xml
@@@ -1979,7 -1974,6 +1980,7 @@@ include examples/smpi/comm_dynamic_cost
  include examples/smpi/replay_multiple/CMakeLists.txt
  include examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt
  include examples/smpi/smpi_s4u_masterworker/CMakeLists.txt
 +include examples/sthread/CMakeLists.txt
  include include/simgrid/Exception.hpp
  include include/simgrid/actor.h
  include include/simgrid/barrier.h
@@@ -2061,7 -2055,6 +2062,7 @@@ include include/xbt.
  include include/xbt/Extendable.hpp
  include include/xbt/PropertyHolder.hpp
  include include/xbt/asserts.h
 +include include/xbt/asserts.hpp
  include include/xbt/automaton.h
  include include/xbt/automaton.hpp
  include include/xbt/backtrace.hpp
@@@ -2279,18 -2272,18 +2280,18 @@@ include src/kernel/timer/Timer.cp
  include src/mc/AddressSpace.hpp
  include src/mc/ModelChecker.cpp
  include src/mc/ModelChecker.hpp
 -include src/mc/Session.cpp
 -include src/mc/Session.hpp
  include src/mc/VisitedState.cpp
  include src/mc/VisitedState.hpp
 -include src/mc/api.cpp
 -include src/mc/api.hpp
 +include src/mc/api/ActorState.hpp
 +include src/mc/api/RemoteApp.cpp
 +include src/mc/api/RemoteApp.hpp
  include src/mc/api/State.cpp
  include src/mc/api/State.hpp
  include src/mc/compare.cpp
  include src/mc/explo/CommunicationDeterminismChecker.cpp
  include src/mc/explo/DFSExplorer.cpp
  include src/mc/explo/DFSExplorer.hpp
 +include src/mc/explo/Exploration.cpp
  include src/mc/explo/Exploration.hpp
  include src/mc/explo/LivenessChecker.cpp
  include src/mc/explo/LivenessChecker.hpp
@@@ -2323,11 -2316,17 +2324,11 @@@ include src/mc/mc_config.hp
  include src/mc/mc_exit.hpp
  include src/mc/mc_forward.hpp
  include src/mc/mc_global.cpp
 -include src/mc/mc_hash.cpp
 -include src/mc/mc_hash.hpp
 -include src/mc/mc_ignore.hpp
  include src/mc/mc_mmu.hpp
 -include src/mc/mc_pattern.hpp
  include src/mc/mc_private.hpp
  include src/mc/mc_record.cpp
  include src/mc/mc_record.hpp
  include src/mc/mc_replay.hpp
 -include src/mc/mc_safety.hpp
 -include src/mc/mc_smx.cpp
  include src/mc/remote/AppSide.cpp
  include src/mc/remote/AppSide.hpp
  include src/mc/remote/Channel.cpp
@@@ -2399,6 -2398,7 +2400,6 @@@ include src/simgrid/sg_config.cp
  include src/simgrid/sg_version.cpp
  include src/simgrid/util.hpp
  include src/simix/libsmx.cpp
 -include src/simix/smx_context.cpp
  include src/smpi/bindings/smpi_f77.cpp
  include src/smpi/bindings/smpi_f77_coll.cpp
  include src/smpi/bindings/smpi_f77_comm.cpp
@@@ -2585,9 -2585,6 +2586,9 @@@ include src/smpi/smpif90.i
  include src/smpi/smpiff.in
  include src/smpi/smpirun.in
  include src/smpi/smpitools.sh
 +include src/sthread/sthread.c
 +include src/sthread/sthread.h
 +include src/sthread/sthread_impl.cpp
  include src/surf/HostImpl.cpp
  include src/surf/HostImpl.hpp
  include src/surf/cpu_cas01.cpp
@@@ -2651,7 -2648,6 +2652,7 @@@ include src/xbt/memory_map.cp
  include src/xbt/memory_map.hpp
  include src/xbt/mmalloc/mfree.c
  include src/xbt/mmalloc/mm.c
 +include src/xbt/mmalloc/mm_interface.c
  include src/xbt/mmalloc/mm_legacy.c
  include src/xbt/mmalloc/mm_module.c
  include src/xbt/mmalloc/mmalloc.c
@@@ -29,6 -29,11 +29,11 @@@ Element::Element(Constraint* constraint
  
  int Element::get_concurrency() const
  {
+   // just to try having the computation of the concurrency
+   if (constraint->get_sharing_policy() == Constraint::SharingPolicy::WIFI) {
+     return 1;
+   }
    // Ignore element with weight less than one (e.g. cross-traffic)
    return (consumption_weight >= 1) ? 1 : 0;
    // There are other alternatives, but they will change the behavior of the model..
@@@ -57,7 -62,7 +62,7 @@@ void Element::increase_concurrency(boo
               "Concurrency limit overflow!");
  }
  
 -System* System::build(const std::string& solver_name, bool selective_update)
 +System* System::build(std::string_view solver_name, bool selective_update)
  {
    System* system = nullptr;
    if (solver_name == "bmf") {
@@@ -270,20 -275,18 +275,20 @@@ Element& System::expand_add_to_elem(Ele
    return elem;
  }
  
 -void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
 +void System::expand(Constraint* cnst, Variable* var, double consumption_weight, bool force_creation)
  {
    modified_ = true;
  
    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_) && var->sharing_penalty_ != 0.0) {
 +
 +  bool reuse_elem = elem_it != end(var->cnsts_) && not force_creation;
 +  if (reuse_elem && var->sharing_penalty_ != 0.0) {
      /* before changing it, decreases concurrency on constraint, it'll be added back later */
      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);
 +  Element& elem = reuse_elem ? expand_add_to_elem(*elem_it, cnst, consumption_weight)
 +                             : expand_create_elem(cnst, var, consumption_weight);
  
    // Check if we need to disable the variable
    if (var->sharing_penalty_ != 0) {
@@@ -756,7 -759,7 +761,7 @@@ double Constraint::get_usage() cons
  
  void Constraint::set_sharing_policy(SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
  {
-   xbt_assert(policy == SharingPolicy::NONLINEAR || not cb,
+   xbt_assert(policy == SharingPolicy::NONLINEAR || policy == SharingPolicy::WIFI || not cb,
               "Invalid sharing policy for constraint. Callback should be used with NONLINEAR sharing policy");
    sharing_policy_    = policy;
    dyn_constraint_cb_ = cb;
@@@ -18,7 -18,6 +18,7 @@@
  #include <cmath>
  #include <limits>
  #include <memory>
 +#include <string_view>
  #include <vector>
  
  namespace simgrid::kernel::lmm {
@@@ -206,7 -205,7 +206,7 @@@ public
   */
  class XBT_PUBLIC Constraint {
  public:
-   enum class SharingPolicy { NONLINEAR = 2, SHARED = 1, FATPIPE = 0 };
+   enum class SharingPolicy { WIFI = 3, NONLINEAR = 2, SHARED = 1, FATPIPE = 0 };
  
    Constraint(resource::Resource* id_value, double bound_value);
  
@@@ -419,7 -418,7 +419,7 @@@ public
     * @param selective_update Enables lazy updates
     * @return pointer to System instance
     */
 -  static System* build(const std::string& solver_name, bool selective_update);
 +  static System* build(std::string_view solver_name, bool selective_update);
    /** @brief Validates solver configuration */
    static void validate_solver(const std::string& solver_name);
  
     * @param cnst A constraint
     * @param var A variable
     * @param value The coefficient associated to the variable in the constraint
 +   * @param force_creation Force the creation of new element linking the variable to the constraint. Should be used only
 +   * by the model ptask_L07 to cope with ptasks composed of flows running on the same resource (see
 +   * https://framagit.org/simgrid/simgrid/-/issues/111)
     */
 -  void expand(Constraint * cnst, Variable * var, double value);
 +  void expand(Constraint* cnst, Variable* var, double value, bool force_creation = false);
  
    /** @brief Update the bound of a variable */
    void update_variable_bound(Variable * var, double bound);
@@@ -93,7 -93,7 +93,7 @@@ NetworkCm02Model::NetworkCm02Model(cons
      select = true;
    }
  
 -  set_maxmin_system(lmm::System::build(cfg_network_solver, select));
 +  set_maxmin_system(lmm::System::build(cfg_network_solver.get(), select));
  
    loopback_.reset(create_link("__loopback__", {config::get_value<double>("network/loopback-bw")}));
    loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
@@@ -225,19 -225,22 +225,22 @@@ void NetworkCm02Model::comm_action_expa
  
    /* WI-FI links needs special treatment, do it here */
    if (src_wifi_link != nullptr) {
-     /* In case of 0Mbps data rate, don't consider it in the LMM */
      if (src_wifi_link->get_host_rate(src) > 0)
        get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(),
                                    1.0 / src_wifi_link->get_host_rate(src));
-     else
+     else {
        get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+     }
    }
    if (dst_wifi_link != nullptr) {
      if (dst_wifi_link->get_host_rate(dst) > 0)
        get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(),
                                    1.0 / dst_wifi_link->get_host_rate(dst));
-     else
+     else {
        get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+     }
    }
  
    for (auto const* link : route) {
@@@ -248,11 -248,6 +248,11 @@@ set(SMPI_SR
    src/surf/network_ib.cpp
    src/surf/network_smpi.cpp
    )
 +set(STHREAD_SRC
 +  src/sthread/sthread_impl.cpp
 +  src/sthread/sthread.c
 +  src/sthread/sthread.h
 +)
  
  set(XBT_SRC
    src/xbt/OsSemaphore.hpp
    )
  
  if(HAVE_MMALLOC)
 -  set(XBT_SRC ${XBT_SRC}  src/xbt/mmalloc/mm.c )
 +  set(SGMALLOC_SRC src/xbt/mmalloc/mm.c)
 +  set(XBT_SRC      ${XBT_SRC} src/xbt/mmalloc/mm.c)
  else()
    set(EXTRA_DIST ${EXTRA_DIST} src/xbt/mmalloc/mm.c)
  endif()
@@@ -433,6 -427,7 +433,6 @@@ set(SIMIX_SR
    src/kernel/context/ContextThread.cpp
    src/kernel/context/ContextThread.hpp
    src/simix/libsmx.cpp
 -  src/simix/smx_context.cpp
    )
  
  # Boost context may not be available
@@@ -575,7 -570,6 +575,7 @@@ set(MC_SR
    src/mc/explo/CommunicationDeterminismChecker.cpp
    src/mc/explo/DFSExplorer.cpp
    src/mc/explo/DFSExplorer.hpp
 +  src/mc/explo/Exploration.cpp
    src/mc/explo/Exploration.hpp
    src/mc/explo/LivenessChecker.cpp
    src/mc/explo/LivenessChecker.hpp
    src/mc/AddressSpace.hpp
    src/mc/ModelChecker.cpp
    src/mc/ModelChecker.hpp
 -  src/mc/Session.cpp
 -  src/mc/Session.hpp
    src/mc/VisitedState.cpp
    src/mc/VisitedState.hpp
 -  src/mc/api.cpp
 -  src/mc/api.hpp
 +  src/mc/api/ActorState.hpp
    src/mc/api/State.cpp
    src/mc/api/State.hpp
 +  src/mc/api/RemoteApp.cpp
 +  src/mc/api/RemoteApp.hpp
    src/mc/compare.cpp
    src/mc/mc_client_api.cpp
    src/mc/mc_exit.hpp
    src/mc/mc_forward.hpp
 -  src/mc/mc_hash.cpp
 -  src/mc/mc_hash.hpp
 -  src/mc/mc_ignore.hpp
 -  src/mc/mc_pattern.hpp
    src/mc/mc_private.hpp
    src/mc/mc_record.cpp
 -  src/mc/mc_safety.hpp
 -  src/mc/mc_smx.cpp
    src/mc/udpor_global.cpp
    src/mc/udpor_global.hpp
 +
 +  src/xbt/mmalloc/mm_interface.c
    )
  
  set(MC_SIMGRID_MC_SRC  src/mc/explo/simgrid_mc.cpp)
@@@ -733,7 -732,6 +733,7 @@@ set(headers_to_instal
    include/smpi/forward.hpp
    include/xbt.h
    include/xbt/asserts.h
 +  include/xbt/asserts.hpp
    include/xbt/automaton.h
    include/xbt/automaton.hpp
    include/xbt/backtrace.hpp
@@@ -1032,7 -1030,6 +1032,7 @@@ set(CMAKEFILES_TX
    examples/smpi/replay_multiple/CMakeLists.txt
    examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt
    examples/smpi/smpi_s4u_masterworker/CMakeLists.txt
 +  examples/sthread/CMakeLists.txt
  
    teshsuite/java/CMakeLists.txt
    teshsuite/kernel/CMakeLists.txt
@@@ -1211,6 -1208,7 +1211,7 @@@ set(PLATFORMS_EXAMPLE
    examples/platforms/vivaldi.xml
    examples/platforms/wifi.xml
    examples/platforms/wifi_energy.xml
+   examples/platforms/wifi_large_cell.xml
    examples/platforms/wifi_ns3.xml
    )