Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[smpi] s4u processes are actors
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 12 May 2018 00:21:47 +0000 (02:21 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 12 May 2018 00:21:47 +0000 (02:21 +0200)
src/smpi/include/smpi_process.hpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_process.cpp
src/smpi/mpi/smpi_request.cpp

index 22431c7..92d8f9d 100644 (file)
@@ -34,7 +34,7 @@ class Process {
     bool replaying_                 = false; /* is the process replaying a trace */
     msg_bar_t finalization_barrier_;
     smpi_trace_call_location_t trace_call_loc_;
     bool replaying_                 = false; /* is the process replaying a trace */
     msg_bar_t finalization_barrier_;
     smpi_trace_call_location_t trace_call_loc_;
-    simgrid::s4u::ActorPtr process_ = nullptr;
+    simgrid::s4u::ActorPtr actor_ = nullptr;
     smpi_privatization_region_t privatized_region_;
     int optind=0; /*for getopt replacement */
 #if HAVE_PAPI
     smpi_privatization_region_t privatized_region_;
     int optind=0; /*for getopt replacement */
 #if HAVE_PAPI
@@ -75,7 +75,7 @@ class Process {
     int sampling();
     msg_bar_t finalization_barrier();
     static void init(int *argc, char ***argv);
     int sampling();
     msg_bar_t finalization_barrier();
     static void init(int *argc, char ***argv);
-    simgrid::s4u::ActorPtr process();
+    simgrid::s4u::ActorPtr get_actor();
     int get_optind();
     void set_optind(int optind);
 };
     int get_optind();
     void set_optind(int optind);
 };
index 19a3b5e..0b0c168 100644 (file)
@@ -48,7 +48,7 @@ void smpi_execute_(double *duration)
 void smpi_execute_flops(double flops) {
   xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops);
   XBT_DEBUG("Handle real computation time: %f flops", flops);
 void smpi_execute_flops(double flops) {
   xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops);
   XBT_DEBUG("Handle real computation time: %f flops", flops);
-  smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->get_host());
+  smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->get_actor()->get_host());
   simcall_set_category (action, TRACE_internal_smpi_get_category());
   simcall_execution_wait(action);
   smpi_switch_data_segment(simgrid::s4u::Actor::self());
   simcall_set_category (action, TRACE_internal_smpi_get_category());
   simcall_execution_wait(action);
   smpi_switch_data_segment(simgrid::s4u::Actor::self());
index 48459a9..2a00d40 100644 (file)
@@ -19,10 +19,10 @@ using simgrid::s4u::Actor;
 using simgrid::s4u::ActorPtr;
 
 Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
 using simgrid::s4u::ActorPtr;
 
 Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
-    : finalization_barrier_(finalization_barrier), process_(actor)
+    : finalization_barrier_(finalization_barrier), actor_(actor)
 {
 {
-  mailbox_         = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(process_->get_pid()));
-  mailbox_small_   = simgrid::s4u::Mailbox::byName("small-" + std::to_string(process_->get_pid()));
+  mailbox_         = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(actor_->get_pid()));
+  mailbox_small_   = simgrid::s4u::Mailbox::byName("small-" + std::to_string(actor_->get_pid()));
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
   state_           = SMPI_UNINITIALIZED;
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
   state_           = SMPI_UNINITIALIZED;
@@ -65,8 +65,8 @@ void Process::set_data(int* argc, char*** argv)
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
     finalization_barrier_ = barrier;
 
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
     finalization_barrier_ = barrier;
 
-  process_                                                                  = simgrid::s4u::Actor::self();
-  static_cast<simgrid::msg::ActorExt*>(process_->get_impl()->getUserData())->data = this;
+  actor_                                                                        = simgrid::s4u::Actor::self();
+  static_cast<simgrid::msg::ActorExt*>(actor_->get_impl()->getUserData())->data = this;
 
   if (*argc > 3) {
     memmove(&(*argv)[0], &(*argv)[2], sizeof(char*) * (*argc - 2));
 
   if (*argc > 3) {
     memmove(&(*argv)[0], &(*argv)[2], sizeof(char*) * (*argc - 2));
@@ -77,15 +77,15 @@ void Process::set_data(int* argc, char*** argv)
   argc_ = argc;
   argv_ = argv;
   // set the process attached to the mailbox
   argc_ = argc;
   argv_ = argv;
   // set the process attached to the mailbox
-  mailbox_small_->setReceiver(process_);
-  XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->get_pid(), process_.get());
+  mailbox_small_->setReceiver(actor_);
+  XBT_DEBUG("<%ld> SMPI process has been initialized: %p", actor_->get_pid(), actor_.get());
 }
 
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
   state_ = SMPI_FINALIZED;
 }
 
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
   state_ = SMPI_FINALIZED;
-  XBT_DEBUG("<%ld> Process left the game", process_->get_pid());
+  XBT_DEBUG("<%ld> Process left the game", actor_->get_pid());
 
   // This leads to an explosion of the search graph which cannot be reduced:
   if(MC_is_active() || MC_record_replay_is_active())
 
   // This leads to an explosion of the search graph which cannot be reduced:
   if(MC_is_active() || MC_record_replay_is_active())
@@ -134,8 +134,9 @@ void *Process::get_user_data()
   return data_;
 }
 
   return data_;
 }
 
-ActorPtr Process::process(){
-  return process_;
+ActorPtr Process::get_actor()
+{
+  return actor_;
 }
 
 /**
 }
 
 /**
@@ -210,7 +211,7 @@ MPI_Comm Process::comm_self()
   if(comm_self_==MPI_COMM_NULL){
     MPI_Group group = new  Group(1);
     comm_self_ = new  Comm(group, nullptr);
   if(comm_self_==MPI_COMM_NULL){
     MPI_Group group = new  Group(1);
     comm_self_ = new  Comm(group, nullptr);
-    group->set_mapping(process_, 0);
+    group->set_mapping(actor_, 0);
   }
   return comm_self_;
 }
   }
   return comm_self_;
 }
index 2773b78..7ba5935 100644 (file)
@@ -401,7 +401,7 @@ void Request::start()
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     real_size_=size_;
     action_   = simcall_comm_irecv(
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     real_size_=size_;
     action_   = simcall_comm_irecv(
-        process->process()->get_impl(), mailbox, buf_, &real_size_, &match_recv,
+        process->get_actor()->get_impl(), mailbox, buf_, &real_size_, &match_recv,
         process->replaying() ? &smpi_comm_null_copy_buffer_callback : smpi_comm_copy_data_callback, this, -1.0);
     XBT_DEBUG("recv simcall posted");
 
         process->replaying() ? &smpi_comm_null_copy_buffer_callback : smpi_comm_copy_data_callback, this, -1.0);
     XBT_DEBUG("recv simcall posted");
 
@@ -675,7 +675,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   if (smpi_iprobe_sleep > 0) {
     smx_activity_t iprobe_sleep = simcall_execution_start(
         "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0,
   if (smpi_iprobe_sleep > 0) {
     smx_activity_t iprobe_sleep = simcall_execution_start(
         "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0,
-        /* performance bound */ maxrate * speed, smpi_process()->process()->get_impl()->host);
+        /* performance bound */ maxrate * speed, smpi_process()->get_actor()->get_host());
     simcall_execution_wait(iprobe_sleep);
   }
   // behave like a receive, but don't do it
     simcall_execution_wait(iprobe_sleep);
   }
   // behave like a receive, but don't do it