Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
say bye to simgrid::surf namespace
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 8 Nov 2021 08:47:34 +0000 (09:47 +0100)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 8 Nov 2021 08:47:34 +0000 (09:47 +0100)
19 files changed:
doc/doxygen/inside_extending.doc
doc/doxygen/uhood_switch.doc
include/simgrid/forward.h
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Host.hpp
src/kernel/actor/ActorImpl.hpp
src/kernel/resource/VirtualMachineImpl.hpp
src/kernel/routing/NetZoneImpl.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/LinkImpl.hpp
src/surf/LinkImplIntf.hpp
src/surf/SplitDuplexLinkImpl.hpp
src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/network_interface.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp

index 8dc029b..7668d26 100644 (file)
@@ -44,7 +44,7 @@ void surf_cpu_model_init_plop()
 
   surf_cpu_model_pm = new CpuPlopModel();
 
-  simgrid::surf::on_postparse.connect(cpu_add_traces);
+  simgrid::kernel::resource::on_postparse.connect(cpu_add_traces);
 
   xbt_dynar_push(model_list, &surf_cpu_model_pm);
 }
@@ -191,8 +191,9 @@ simulation.  This call is particularly useful for implementing mutable calls:
 ~~~
 void Host::setProperty(const char*key, const char *value){
   simgrid::simix::kernelImmediate([&] {
-    simgrid::surf::HostImpl* surf_host = this->extension<simgrid::surf::HostImpl>();
-    surf_host->setProperty(key,value);
+    simgrid::kernel::resource::HostImpl* host =
+       this->extension<simgrid::kernel::resource::HostImpl>();
+    host->setProperty(key,value);
   });
 }
 ~~~
index 7cd30d0..40c7b46 100644 (file)
@@ -439,9 +439,9 @@ Example of usage:
 @code{cpp}
 xbt_dict_t Host::properties() {
   return simgrid::simix::kernelImmediate([&] {
-    simgrid::surf::HostImpl* surf_host =
-      this->extension<simgrid::surf::HostImpl>();
-    return surf_host->getProperties();
+    simgrid::kernel::resource::HostImpl* host =
+      this->extension<simgrid::kernel::resource::HostImpl>();
+    return host->getProperties();
   });
 }
 @endcode
index 64f9183..f5f5c6a 100644 (file)
@@ -168,6 +168,8 @@ class CpuImpl;
 class Model;
 class Resource;
 class CpuModel;
+class HostImpl;
+class HostModel;
 class NetworkModel;
 class NetworkModelIntf;
 class LinkImpl;
@@ -192,10 +194,6 @@ class FutureEvtSet;
 class Profile;
 } // namespace profile
 } // namespace kernel
-namespace surf {
-  class HostImpl;
-  class HostModel;
-}
 namespace mc {
 class CommunicationDeterminismChecker;
 }
index 6acc05b..4ca0386 100644 (file)
@@ -129,7 +129,7 @@ public:
   /** @brief Retrieves the disk model associated to this NetZone */
   const std::shared_ptr<resource::DiskModel>& get_disk_model() const { return disk_model_; }
   /** @brief Retrieves the host model associated to this NetZone */
-  const std::shared_ptr<surf::HostModel>& get_host_model() const { return host_model_; }
+  const std::shared_ptr<resource::HostModel>& get_host_model() const { return host_model_; }
 
   const s4u::NetZone* get_iface() const { return &piface_; }
   s4u::NetZone* get_iface() { return &piface_; }
@@ -181,7 +181,7 @@ public:
   void set_cpu_vm_model(std::shared_ptr<resource::CpuModel> cpu_model);
   void set_cpu_pm_model(std::shared_ptr<resource::CpuModel> cpu_model);
   void set_disk_model(std::shared_ptr<resource::DiskModel> disk_model);
-  void set_host_model(std::shared_ptr<surf::HostModel> host_model);
+  void set_host_model(std::shared_ptr<resource::HostModel> host_model);
 
   /** @brief get the route between two nodes in the full platform
    *
@@ -213,7 +213,7 @@ private:
   std::shared_ptr<resource::CpuModel> cpu_model_vm_;
   std::shared_ptr<resource::CpuModel> cpu_model_pm_;
   std::shared_ptr<resource::DiskModel> disk_model_;
-  std::shared_ptr<surf::HostModel> host_model_;
+  std::shared_ptr<resource::HostModel> host_model_;
   /** @brief Perform sealing procedure for derived classes, if necessary */
   virtual void do_seal()
   { /* obviously nothing to do by default */
index 7856a1f..2a88c38 100644 (file)
@@ -84,12 +84,12 @@ public:
 
 protected:
 #ifndef DOXYGEN
-  friend surf::HostImpl;
   friend Host;
   friend Link;
   friend Disk;
   friend kernel::routing::NetPoint;
   friend kernel::routing::NetZoneImpl;
+  friend kernel::resource::HostImpl;
   friend kernel::resource::LinkImpl;
   void host_register(const std::string& name, Host* host);
   void host_unregister(const std::string& name);
index 7be79dc..e745232 100644 (file)
@@ -40,16 +40,16 @@ class XBT_PUBLIC Host : public xbt::Extendable<Host> {
   friend kernel::resource::VMModel;            // Use the pimpl_cpu to compute the VM sharing
   friend kernel::resource::VirtualMachineImpl; // creates the the pimpl_cpu
   friend kernel::routing::NetZoneImpl;
-  friend surf::HostImpl; // call destructor from private implementation
+  friend kernel::resource::HostImpl; // call destructor from private implementation
 
   // The private implementation, that never changes
-  surf::HostImpl* const pimpl_;
+  kernel::resource::HostImpl* const pimpl_;
 
   kernel::resource::CpuImpl* pimpl_cpu_      = nullptr;
   kernel::routing::NetPoint* pimpl_netpoint_ = nullptr;
 
 public:
-  explicit Host(surf::HostImpl* pimpl) : pimpl_(pimpl) {}
+  explicit Host(kernel::resource::HostImpl* pimpl) : pimpl_(pimpl) {}
 
 protected:
   virtual ~Host(); // Call destroy() instead of manually deleting it.
@@ -243,7 +243,7 @@ public:
 
   /** Block the calling actor on an execution located on the called host (with explicit priority) */
   void execute(double flops, double priority) const;
-  surf::HostImpl* get_impl() const { return pimpl_; }
+  kernel::resource::HostImpl* get_impl() const { return pimpl_; }
 };
 } // namespace s4u
 } // namespace simgrid
index e9c6e4b..b5ae3c0 100644 (file)
@@ -41,7 +41,7 @@ public:
   static ActorImpl* self();
   double get_kill_time() const;
   void set_kill_time(double kill_time);
-  boost::intrusive::list_member_hook<> host_actor_list_hook;   /* simgrid::surf::HostImpl::actor_list_ */
+  boost::intrusive::list_member_hook<> host_actor_list_hook;     /* resource::HostImpl::actor_list_ */
   boost::intrusive::list_member_hook<> kernel_destroy_list_hook; /* EngineImpl actors_to_destroy */
   boost::intrusive::list_member_hook<> smx_synchro_hook;       /* {mutex,cond,sem}->sleeping */
 
index 6ab458f..3e2fc06 100644 (file)
@@ -21,7 +21,7 @@ namespace resource {
  * Resource *
  ************/
 
-class XBT_PUBLIC VirtualMachineImpl : public surf::HostImpl, public xbt::Extendable<VirtualMachineImpl> {
+class XBT_PUBLIC VirtualMachineImpl : public HostImpl, public xbt::Extendable<VirtualMachineImpl> {
 #ifndef DOXYGEN
   friend s4u::VirtualMachine;
 #endif
@@ -84,7 +84,7 @@ private:
  * @brief SURF VM model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class XBT_PRIVATE VMModel : public surf::HostModel {
+class XBT_PRIVATE VMModel : public HostModel {
 public:
   explicit VMModel(const std::string& name);
 
index ccaeb57..7f8f8ee 100644 (file)
@@ -151,7 +151,7 @@ s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<d
   xbt_assert(cpu_model_pm_,
              "Impossible to create host: %s. Invalid CPU model: nullptr. Have you set the parent of this NetZone: %s?",
              name.c_str(), get_cname());
-  auto* res = (new surf::HostImpl(name))->get_iface();
+  auto* res = (new resource::HostImpl(name))->get_iface();
   res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
 
   cpu_model_pm_->create_cpu(res, speed_per_pstate);
@@ -581,7 +581,7 @@ void NetZoneImpl::set_disk_model(std::shared_ptr<resource::DiskModel> disk_model
   disk_model_ = std::move(disk_model);
 }
 
-void NetZoneImpl::set_host_model(std::shared_ptr<surf::HostModel> host_model)
+void NetZoneImpl::set_host_model(std::shared_ptr<resource::HostModel> host_model)
 {
   xbt_assert(not sealed_, "Impossible to set host model to an already sealed NetZone(%s)", this->get_cname());
   host_model_ = std::move(host_model);
index cb429d0..f105aa5 100644 (file)
@@ -19,7 +19,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_host, ker_resource, "Host resources agregate
  *************/
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 /*********
  * Model *
@@ -47,7 +48,7 @@ HostImpl::~HostImpl()
     for (auto const& actor : actor_list_)
       msg += "\n\t" + std::string(actor.get_name());
 
-    kernel::EngineImpl::get_instance()->display_all_actor_status();
+    EngineImpl::get_instance()->display_all_actor_status();
     xbt_die("%s", msg.c_str());
   }
   for (auto const& arg : actors_at_boot_)
@@ -77,8 +78,7 @@ void HostImpl::turn_on() const
 {
   for (auto const& arg : actors_at_boot_) {
     XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname());
-    simgrid::kernel::actor::ActorImplPtr actor =
-        simgrid::kernel::actor::ActorImpl::create(arg->name, arg->code, nullptr, arg->host, nullptr);
+    actor::ActorImplPtr actor = actor::ActorImpl::create(arg->name, arg->code, nullptr, arg->host, nullptr);
     actor->set_properties(arg->properties);
     if (arg->on_exit)
       *actor->on_exit = *arg->on_exit;
@@ -92,7 +92,7 @@ void HostImpl::turn_on() const
 }
 
 /** Kill all actors hosted here */
-void HostImpl::turn_off(const kernel::actor::ActorImpl* issuer)
+void HostImpl::turn_off(const actor::ActorImpl* issuer)
 {
   for (auto& actor : actor_list_) {
     XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
@@ -101,7 +101,7 @@ void HostImpl::turn_off(const kernel::actor::ActorImpl* issuer)
   }
   // When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
   // Then get rid of the others.
-  auto elm = remove_if(begin(actors_at_boot_), end(actors_at_boot_), [](const kernel::actor::ProcessArg* arg) {
+  auto elm = remove_if(begin(actors_at_boot_), end(actors_at_boot_), [](const actor::ProcessArg* arg) {
     if (arg->auto_restart)
       return false;
     delete arg;
@@ -160,5 +160,6 @@ void HostImpl::seal()
   for (auto const& disk : disks_)
     disk.second->seal();
 }
-} // namespace surf
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
index 2b1cfeb..0dcc24d 100644 (file)
@@ -15,8 +15,8 @@
 #include <vector>
 
 namespace simgrid {
-namespace surf {
-
+namespace kernel {
+namespace resource {
 /*********
  * Model *
  *********/
@@ -25,12 +25,11 @@ namespace surf {
  * @brief SURF Host model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-class XBT_PRIVATE HostModel : public kernel::resource::Model {
+class XBT_PRIVATE HostModel : public Model {
 public:
   using Model::Model;
-  virtual kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list,
-                                                     const double* flops_amount, const double* bytes_amount,
-                                                     double rate) = 0;
+  virtual Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                   const double* bytes_amount, double rate) = 0;
 };
 
 /************
@@ -41,15 +40,15 @@ public:
  * @details A host represents a machine with an aggregation of a Cpu, a RoutingEdge and Disk(s)
  */
 class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
-  using ActorList = boost::intrusive::list<
-      kernel::actor::ActorImpl,
-      boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
-                                    &kernel::actor::ActorImpl::host_actor_list_hook>>;
+  using ActorList =
+      boost::intrusive::list<actor::ActorImpl,
+                             boost::intrusive::member_hook<actor::ActorImpl, boost::intrusive::list_member_hook<>,
+                                                           &actor::ActorImpl::host_actor_list_hook>>;
 
   ActorList actor_list_;
-  std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
+  std::vector<actor::ProcessArg*> actors_at_boot_;
   s4u::Host piface_;
-  std::map<std::string, kernel::resource::DiskImpl*, std::less<>> disks_;
+  std::map<std::string, DiskImpl*, std::less<>> disks_;
   xbt::string name_{"noname"};
   bool sealed_ = false;
 
@@ -58,7 +57,7 @@ protected:
   HostImpl(const std::string& name, s4u::Host* piface);
 
 public:
-  friend kernel::resource::VirtualMachineImpl;
+  friend VirtualMachineImpl;
   explicit HostImpl(const std::string& name);
 
   void destroy(); // Must be called instead of the destructor
@@ -77,12 +76,12 @@ public:
   const char* get_cname() const { return name_.c_str(); }
 
   void turn_on() const;
-  void turn_off(const kernel::actor::ActorImpl* issuer);
+  void turn_off(const actor::ActorImpl* issuer);
   std::vector<s4u::ActorPtr> get_all_actors();
   size_t get_actor_count() const;
-  void add_actor(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
-  void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
-  void add_actor_at_boot(kernel::actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
+  void add_actor(actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
+  void remove_actor(actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
+  void add_actor_at_boot(actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
 
   void seal();
 
@@ -92,7 +91,8 @@ public:
       function(actor);
   }
 };
-} // namespace surf
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
 
-#endif /* SURF_HOST_INTERFACE_HPP */
+#endif /* HOST_INTERFACE_HPP */
index 5148d54..e49c884 100644 (file)
@@ -20,7 +20,7 @@ namespace resource {
  ************/
 /** @ingroup SURF_network_interface
  * @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref simgrid::kernel::resource::HostImpl)
  */
 class LinkImpl : public LinkImplIntf {
   s4u::Link piface_;
index 0f10e42..6845de0 100644 (file)
@@ -22,7 +22,7 @@ namespace resource {
  ************/
 /** @ingroup SURF_interface
  * @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref HostImpl)
  */
 class LinkImplIntf : public Resource_T<LinkImplIntf>, public xbt::PropertyHolder {
 public:
index 4842f08..231e130 100644 (file)
@@ -21,7 +21,7 @@ namespace resource {
  ************/
 /** @ingroup SURF_network_interface
  * @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref HostImpl)
  */
 class SplitDuplexLinkImpl : public LinkImplIntf {
   s4u::SplitDuplexLink piface_;
index 21c9623..3a7b012 100644 (file)
@@ -16,7 +16,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_host);
 void surf_host_model_init_current_default()
 {
   simgrid::config::set_default<bool>("network/crosstraffic", true);
-  auto host_model = std::make_shared<simgrid::surf::HostCLM03Model>("Host_CLM03");
+  auto host_model = std::make_shared<simgrid::kernel::resource::HostCLM03Model>("Host_CLM03");
   auto* engine    = simgrid::kernel::EngineImpl::get_instance();
   engine->add_model(host_model);
   engine->get_netzone_root()->set_host_model(host_model);
@@ -26,15 +26,17 @@ void surf_host_model_init_current_default()
 
 void surf_host_model_init_compound()
 {
-  auto host_model = std::make_shared<simgrid::surf::HostCLM03Model>("Host_CLM03");
+  auto host_model = std::make_shared<simgrid::kernel::resource::HostCLM03Model>("Host_CLM03");
   auto* engine    = simgrid::kernel::EngineImpl::get_instance();
   engine->add_model(host_model);
   engine->get_netzone_root()->set_host_model(host_model);
 }
 
 namespace simgrid {
-namespace surf {
-double HostCLM03Model::next_occurring_event(double now)
+namespace kernel {
+namespace resource {
+
+double HostCLM03Model::next_occurring_event(double /*now*/)
 {
   /* nothing specific to be done here
    * surf_solve already calls all the models next_occurring_event properly */
@@ -54,11 +56,10 @@ static inline double has_cost(const double* array, size_t pos)
   return -1.0;
 }
 
-kernel::resource::Action* HostCLM03Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
-                                                           const double* flops_amount, const double* bytes_amount,
-                                                           double rate)
+Action* HostCLM03Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                         const double* bytes_amount, double rate)
 {
-  kernel::resource::Action* action = nullptr;
+  Action* action = nullptr;
   auto net_model = host_list[0]->get_netpoint()->get_englobing_zone()->get_network_model();
   if ((host_list.size() == 1) && (has_cost(bytes_amount, 0) <= 0) && (has_cost(flops_amount, 0) > 0)) {
     action = host_list[0]->get_cpu()->execution_start(flops_amount[0], rate);
@@ -93,5 +94,6 @@ kernel::resource::Action* HostCLM03Model::execute_parallel(const std::vector<s4u
   return action;
 }
 
-} // namespace surf
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
index d1be826..34dfff7 100644 (file)
@@ -5,25 +5,27 @@
 
 #include "src/surf/HostImpl.hpp"
 
-#ifndef SURF_HOST_CLM03_HPP_
-#define SURF_HOST_CLM03_HPP_
+#ifndef HOST_CLM03_HPP_
+#define HOST_CLM03_HPP_
 
 /***********
  * Classes *
  ***********/
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 class XBT_PRIVATE HostCLM03Model : public HostModel {
 public:
   using HostModel::HostModel;
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
-  kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
-                                             const double* bytes_amount, double rate) override;
+  Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                           const double* bytes_amount, double rate) override;
 };
-}
-}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
 
-#endif /* SURF_HOST_CLM03_HPP_ */
+#endif /* HOST_CLM03_HPP_ */
index 0f775b6..039af7f 100644 (file)
@@ -99,7 +99,7 @@ public:
  **********/
 /** @ingroup SURF_network_interface
  * @brief SURF network action interface class
- * @details A NetworkAction represents a communication between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A NetworkAction represents a communication between two [hosts](@ref HostImpl)
  */
 class NetworkAction : public Action {
   s4u::Host& src_;
index 351bca8..bd0f778 100644 (file)
@@ -23,22 +23,23 @@ void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
 
-  auto host_model = std::make_shared<simgrid::surf::HostL07Model>("Host_Ptask");
+  auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask");
   auto* engine    = simgrid::kernel::EngineImpl::get_instance();
   engine->add_model(host_model);
   engine->get_netzone_root()->set_host_model(host_model);
 }
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 HostL07Model::HostL07Model(const std::string& name) : HostModel(name)
 {
-  auto* maxmin_system = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */);
+  auto* maxmin_system = new lmm::FairBottleneck(true /* selective update */);
   set_maxmin_system(maxmin_system);
 
   auto net_model = std::make_shared<NetworkL07Model>("Network_Ptask", this, maxmin_system);
-  auto engine    = simgrid::kernel::EngineImpl::get_instance();
+  auto engine    = EngineImpl::get_instance();
   engine->add_model(net_model);
   engine->get_netzone_root()->set_network_model(net_model);
 
@@ -47,7 +48,7 @@ HostL07Model::HostL07Model(const std::string& name) : HostModel(name)
   engine->get_netzone_root()->set_cpu_pm_model(cpu_model);
 }
 
-CpuL07Model::CpuL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys)
+CpuL07Model::CpuL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys)
     : CpuModel(name), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
@@ -58,7 +59,7 @@ CpuL07Model::~CpuL07Model()
   set_maxmin_system(nullptr);
 }
 
-NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys)
+NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys)
     : NetworkModel(name), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
@@ -76,7 +77,7 @@ NetworkL07Model::~NetworkL07Model()
 double HostL07Model::next_occurring_event(double now)
 {
   double min = HostModel::next_occurring_event_full(now);
-  for (kernel::resource::Action const& action : *get_started_action_set()) {
+  for (Action const& action : *get_started_action_set()) {
     const auto& net_action = static_cast<const L07Action&>(action);
     if (net_action.get_latency() > 0 && (min < 0 || net_action.get_latency() < min)) {
       min = net_action.get_latency();
@@ -119,19 +120,19 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
 
     if (((action.get_remains() <= 0) && (action.get_variable()->get_penalty() > 0)) ||
         ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::FINISHED);
+      action.finish(Action::State::FINISHED);
       continue;
     }
 
     /* Need to check that none of the model has failed */
     int i                               = 0;
-    const kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i);
+    const lmm::Constraint* cnst         = action.get_variable()->get_constraint(i);
     while (cnst != nullptr) {
       i++;
-      const kernel::resource::Resource* constraint_id = cnst->get_id();
+      const Resource* constraint_id = cnst->get_id();
       if (not constraint_id->is_on()) {
         XBT_DEBUG("Action (%p) Failed!!", &action);
-        action.finish(kernel::resource::Action::State::FAILED);
+        action.finish(Action::State::FAILED);
         break;
       }
       cnst = action.get_variable()->get_constraint(i);
@@ -139,15 +140,14 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
   }
 }
 
-kernel::resource::CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
-                                                            const double* flops_amount, const double* bytes_amount,
-                                                            double rate)
+CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                          const double* bytes_amount, double rate)
 {
   return new L07Action(this, host_list, flops_amount, bytes_amount, rate);
 }
 
-L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list,
-                     const double* flops_amount, const double* bytes_amount, double rate)
+L07Action::L07Action(Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                     const double* bytes_amount, double rate)
     : CpuAction(model, 1.0, false), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
 {
   size_t link_nb      = 0;
@@ -169,7 +169,7 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host
         continue;
 
       double lat = 0.0;
-      std::vector<kernel::resource::LinkImpl*> route;
+      std::vector<LinkImpl*> route;
       hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, &lat);
       latency = std::max(latency, lat);
 
@@ -206,7 +206,7 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host
     for (size_t k = 0; k < host_list.size() * host_list.size(); k++) {
       if (bytes_amount[k] <= 0.0)
         continue;
-      std::vector<kernel::resource::LinkImpl*> route;
+      std::vector<LinkImpl*> route;
       hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, nullptr);
 
       for (auto const& link : route)
@@ -220,7 +220,7 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host
   }
 }
 
-kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
 {
   std::vector<s4u::Host*> host_list = {src, dst};
   const auto* flops_amount          = new double[2]();
@@ -228,17 +228,17 @@ kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host
 
   bytes_amount[1] = size;
 
-  kernel::resource::Action* res = hostModel_->execute_parallel(host_list, flops_amount, bytes_amount, rate);
+  Action* res = hostModel_->execute_parallel(host_list, flops_amount, bytes_amount, rate);
   static_cast<L07Action*>(res)->free_arrays_ = true;
   return res;
 }
 
-kernel::resource::CpuImpl* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
+CpuImpl* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
 {
   return (new CpuL07(host, speed_per_pstate))->set_model(this);
 }
 
-kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
+LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
   auto link = new LinkL07(name, bandwidths[0], get_maxmin_system());
@@ -246,8 +246,7 @@ kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name
   return link;
 }
 
-kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name,
-                                                              const std::vector<double>& bandwidths)
+LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   THROW_UNIMPLEMENTED;
 }
@@ -256,7 +255,7 @@ kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string&
  * Resource *
  ************/
 
-kernel::resource::CpuAction* CpuL07::execution_start(double size, double user_bound)
+CpuAction* CpuL07::execution_start(double size, double user_bound)
 {
   std::vector<s4u::Host*> host_list = {get_iface()};
   xbt_assert(user_bound <= 0, "User bound not supported by ptask model");
@@ -264,17 +263,17 @@ kernel::resource::CpuAction* CpuL07::execution_start(double size, double user_bo
   auto* flops_amount = new double[host_list.size()]();
   flops_amount[0]    = size;
 
-  kernel::resource::CpuAction* res =
+  CpuAction* res =
       static_cast<CpuL07Model*>(get_model())->hostModel_->execute_parallel(host_list, flops_amount, nullptr, -1);
   static_cast<L07Action*>(res)->free_arrays_ = true;
   return res;
 }
 
-kernel::resource::CpuAction* CpuL07::sleep(double duration)
+CpuAction* CpuL07::sleep(double duration)
 {
   auto* action = static_cast<L07Action*>(execution_start(1.0, -1));
   action->set_max_duration(duration);
-  action->set_suspend_state(kernel::resource::Action::SuspendStates::SLEEPING);
+  action->set_suspend_state(Action::SuspendStates::SLEEPING);
   get_model()->get_maxmin_system()->update_variable_penalty(action->get_variable(), 0.0);
 
   return action;
@@ -283,11 +282,11 @@ kernel::resource::CpuAction* CpuL07::sleep(double duration)
 /** @brief take into account changes of speed (either load or max) */
 void CpuL07::on_speed_change()
 {
-  const kernel::lmm::Element* elem = nullptr;
+  const lmm::Element* elem = nullptr;
 
   get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), speed_.peak * speed_.scale);
   while (const auto* var = get_constraint()->get_variable(&elem)) {
-    const kernel::resource::Action* action = var->get_id();
+    const Action* action = var->get_id();
 
     get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
   }
@@ -295,13 +294,13 @@ void CpuL07::on_speed_change()
   CpuImpl::on_speed_change();
 }
 
-LinkL07::LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name)
+LinkL07::LinkL07(const std::string& name, double bandwidth, lmm::System* system) : LinkImpl(name)
 {
   this->set_constraint(system->constraint_new(this, bandwidth));
   bandwidth_.peak = bandwidth;
 }
 
-void CpuL07::apply_event(kernel::profile::Event* triggered, double value)
+void CpuL07::apply_event(profile::Event* triggered, double value)
 {
   XBT_DEBUG("Updating cpu %s (%p) with value %g", get_cname(), this, value);
   if (triggered == speed_.event) {
@@ -324,7 +323,7 @@ void CpuL07::apply_event(kernel::profile::Event* triggered, double value)
   }
 }
 
-void LinkL07::apply_event(kernel::profile::Event* triggered, double value)
+void LinkL07::apply_event(profile::Event* triggered, double value)
 {
   XBT_DEBUG("Updating link %s (%p) with value=%f", get_cname(), this, value);
   if (triggered == bandwidth_.event) {
@@ -357,7 +356,7 @@ void LinkL07::set_bandwidth(double value)
 void LinkL07::set_latency(double value)
 {
   latency_check(value);
-  const kernel::lmm::Element* elem = nullptr;
+  const lmm::Element* elem = nullptr;
 
   latency_.peak = value;
   while (const auto* var = get_constraint()->get_variable(&elem)) {
@@ -390,7 +389,7 @@ void L07Action::updateBound()
       for (size_t j = 0; j < host_count; j++) {
         if (communicationAmount_[i * host_count + j] > 0) {
           double lat = 0.0;
-          std::vector<kernel::resource::LinkImpl*> route;
+          std::vector<LinkImpl*> route;
           hostList_.at(i)->route_to(hostList_.at(j), route, &lat);
 
           lat_current = std::max(lat_current, lat * communicationAmount_[i * host_count + j]);
@@ -398,7 +397,7 @@ void L07Action::updateBound()
       }
     }
   }
-  double lat_bound = kernel::resource::NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
+  double lat_bound = NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
   XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
   if ((latency_ <= 0.0) && is_running()) {
     if (rate_ < 0)
@@ -408,5 +407,6 @@ void L07Action::updateBound()
   }
 }
 
-} // namespace surf
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
index 9b52893..78dfe83 100644 (file)
@@ -12,7 +12,8 @@
 #define HOST_L07_HPP_
 
 namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
 
 /***********
  * Classes *
@@ -26,9 +27,6 @@ class XBT_PRIVATE CpuL07;
 class XBT_PRIVATE LinkL07;
 
 class XBT_PRIVATE L07Action;
-/*********
- * Tools *
- *********/
 
 /*********
  * Model *
@@ -41,13 +39,13 @@ public:
 
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
-  kernel::resource::CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
-                                                const double* bytes_amount, double rate) override;
+  CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                              const double* bytes_amount, double rate) override;
 };
 
-class CpuL07Model : public kernel::resource::CpuModel {
+class CpuL07Model : public CpuModel {
 public:
-  CpuL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
+  CpuL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys);
   CpuL07Model(const CpuL07Model&) = delete;
   CpuL07Model& operator=(const CpuL07Model&) = delete;
   ~CpuL07Model() override;
@@ -57,20 +55,20 @@ public:
        * method in surf_presolve */
   };
 
-  kernel::resource::CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
+  CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
   HostL07Model* hostModel_;
 };
 
-class NetworkL07Model : public kernel::resource::NetworkModel {
+class NetworkL07Model : public NetworkModel {
 public:
-  NetworkL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
+  NetworkL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys);
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model() override;
-  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
-  kernel::resource::LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
 
-  kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+  Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   void update_actions_state(double /*now*/, double /*delta*/) override{
       /* this action is done by HostL07Model which shares the LMM system with the CPU model
        * Overriding to an empty function here allows us to handle the Cpu07Model as a regular
@@ -84,32 +82,32 @@ public:
  * Resource *
  ************/
 
-class CpuL07 : public kernel::resource::CpuImpl {
+class CpuL07 : public CpuImpl {
 public:
-  using kernel::resource::CpuImpl::CpuImpl;
+  using CpuImpl::CpuImpl;
   CpuL07(const CpuL07&) = delete;
   CpuL07& operator=(const CpuL07&) = delete;
 
-  void apply_event(kernel::profile::Event* event, double value) override;
-  kernel::resource::CpuAction* execution_start(double size, double user_bound) override;
-  kernel::resource::CpuAction* execution_start(double, int, double) override
+  void apply_event(profile::Event* event, double value) override;
+  CpuAction* execution_start(double size, double user_bound) override;
+  CpuAction* execution_start(double, int, double) override
   {
     THROW_UNIMPLEMENTED;
     return nullptr;
   }
-  kernel::resource::CpuAction* sleep(double duration) override;
+  CpuAction* sleep(double duration) override;
 
 protected:
   void on_speed_change() override;
 };
 
-class LinkL07 : public kernel::resource::LinkImpl {
+class LinkL07 : public LinkImpl {
 public:
-  LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system);
+  LinkL07(const std::string& name, double bandwidth, lmm::System* system);
   LinkL07(const LinkL07&) = delete;
   LinkL07& operator=(const LinkL07&) = delete;
   ~LinkL07() override;
-  void apply_event(kernel::profile::Event* event, double value) override;
+  void apply_event(profile::Event* event, double value) override;
   void set_bandwidth(double value) override;
   void set_latency(double value) override;
 };
@@ -117,7 +115,7 @@ public:
 /**********
  * Action *
  **********/
-class L07Action : public kernel::resource::CpuAction {
+class L07Action : public CpuAction {
   std::vector<s4u::Host*> hostList_;
   bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
                              // exec and regular comms
@@ -136,7 +134,7 @@ class L07Action : public kernel::resource::CpuAction {
 
 public:
   L07Action() = delete;
-  L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+  L07Action(Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
             const double* bytes_amount, double rate);
   L07Action(const L07Action&) = delete;
   L07Action& operator=(const L07Action&) = delete;
@@ -148,7 +146,8 @@ public:
   void update_latency(double delta, double precision) { double_update(&latency_, delta, precision); }
 };
 
-} // namespace surf
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
 
 #endif /* HOST_L07_HPP_ */