Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
boss not happy, partial revert
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 24 Oct 2019 15:00:51 +0000 (17:00 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 24 Oct 2019 15:00:51 +0000 (17:00 +0200)
src/plugins/vm/VirtualMachineImpl.cpp
src/smpi/mpi/smpi_comm.cpp
src/surf/HostImpl.hpp

index e499ff0..b7ccd74 100644 (file)
@@ -204,9 +204,9 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer)
 
   action_->suspend();
 
 
   action_->suspend();
 
-  for (auto& actor : get_all_actors()) {
-    XBT_DEBUG("suspend %s", actor->get_cname());
-    actor->suspend();
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("suspend %s", actor.get_cname());
+    actor.suspend();
   }
 
   XBT_DEBUG("suspend all actors on the VM done done");
   }
 
   XBT_DEBUG("suspend all actors on the VM done done");
@@ -224,9 +224,9 @@ void VirtualMachineImpl::resume()
 
   action_->resume();
 
 
   action_->resume();
 
-  for (auto& actor : get_all_actors()) {
-    XBT_DEBUG("resume %s", actor->get_cname());
-    actor->resume();
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("resume %s", actor.get_cname());
+    actor.resume();
   }
 
   vm_state_ = s4u::VirtualMachine::state::RUNNING;
   }
 
   vm_state_ = s4u::VirtualMachine::state::RUNNING;
@@ -261,10 +261,10 @@ void VirtualMachineImpl::shutdown(smx_actor_t issuer)
 
   XBT_DEBUG("shutdown VM %s, that contains %zu actors", piface_->get_cname(), get_actor_count());
 
 
   XBT_DEBUG("shutdown VM %s, that contains %zu actors", piface_->get_cname(), get_actor_count());
 
-  for (auto& actor : get_all_actors()) {
-    XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", actor->get_cname(), actor->get_host()->get_cname(),
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", actor.get_cname(), actor.get_host()->get_cname(),
               issuer->get_cname());
               issuer->get_cname());
-    issuer->kill(actor->get_impl());
+    issuer->kill(&actor);
   }
 
   set_state(s4u::VirtualMachine::state::DESTROYED);
   }
 
   set_state(s4u::VirtualMachine::state::DESTROYED);
index f6b3170..e8e893f 100644 (file)
@@ -340,12 +340,12 @@ void Comm::unref(Comm* comm){
 
 MPI_Comm Comm::find_intra_comm(int * leader){
   //get the indices of all processes sharing the same simix host
 
 MPI_Comm Comm::find_intra_comm(int * leader){
   //get the indices of all processes sharing the same simix host
-  auto actor_list         = sg_host_self()->pimpl_->get_all_actors();
+  auto& actor_list        = sg_host_self()->pimpl_->actor_list_;
   int intra_comm_size     = 0;
   int min_index           = INT_MAX; // the minimum index will be the leader
   for (auto& actor : actor_list) {
   int intra_comm_size     = 0;
   int min_index           = INT_MAX; // the minimum index will be the leader
   for (auto& actor : actor_list) {
-    int index = actor->get_pid();
-    if (this->group()->rank(actor.get()) != MPI_UNDEFINED) { // Is this process in the current group?
+    int index = actor.get_pid();
+    if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) { // Is this process in the current group?
       intra_comm_size++;
       if (index < min_index)
         min_index = index;
       intra_comm_size++;
       if (index < min_index)
         min_index = index;
@@ -355,8 +355,8 @@ MPI_Comm Comm::find_intra_comm(int * leader){
   MPI_Group group_intra = new  Group(intra_comm_size);
   int i = 0;
   for (auto& actor : actor_list) {
   MPI_Group group_intra = new  Group(intra_comm_size);
   int i = 0;
   for (auto& actor : actor_list) {
-    if (this->group()->rank(actor.get()) != MPI_UNDEFINED) {
-      group_intra->set_mapping(actor.get(), i);
+    if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) {
+      group_intra->set_mapping(actor.ciface(), i);
       i++;
     }
   }
       i++;
     }
   }
index 4bdaacf..474fc6e 100644 (file)
@@ -43,14 +43,9 @@ public:
  * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
  */
 class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
  * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
  */
 class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
-  typedef 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>>
-      ActorList;
-  ActorList actor_list_;
 
 public:
 
 public:
+  friend simgrid::vm::VirtualMachineImpl;
   explicit HostImpl(s4u::Host* host);
   virtual ~HostImpl();
 
   explicit HostImpl(s4u::Host* host);
   virtual ~HostImpl();
 
@@ -73,7 +68,14 @@ public:
   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(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
   void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
 
-  // FIXME: make this private
+  typedef 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>>
+      ActorList;
+
+  // FIXME: make these private
+  ActorList actor_list_;
   std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
 };
 }
   std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
 };
 }