]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/smpi_process.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: simplifies the process destruction
[simgrid.git] / src / smpi / smpi_process.cpp
index fbf586f91be7790229fc157bda182110d4527c9b..46918861b8afc053542a0c5f1938ad46e9682d6f 100644 (file)
@@ -35,22 +35,13 @@ namespace smpi{
 Process::Process(int index)
 {
   char name[MAILBOX_NAME_MAXLEN];
-  index_ = MPI_UNDEFINED;
-  argc_                 = nullptr;
-  argv_                 = nullptr;
   mailbox_              = simgrid::s4u::Mailbox::byName(get_mailbox_name(name, index));
   mailbox_small_        = simgrid::s4u::Mailbox::byName(get_mailbox_name_small(name, index));
   mailboxes_mutex_      = xbt_mutex_init();
   timer_                = xbt_os_timer_new();
+  state_                = SMPI_UNINITIALIZED;
   if (MC_is_active())
     MC_ignore_heap(timer_, xbt_os_timer_size());
-  comm_self_            = MPI_COMM_NULL;
-  comm_intra_           = MPI_COMM_NULL;
-  comm_world_           = nullptr;
-  state_                = SMPI_UNINITIALIZED;
-  sampling_             = 0;
-  finalization_barrier_ = nullptr;
-  return_value_         = 0;
 
 #if HAVE_PAPI
   if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
@@ -70,7 +61,7 @@ Process::Process(int index)
 #endif
 }
 
-void Process::set_data(int index, int *argc, char ***argv)
+void Process::set_data(int index, int* argc, char*** argv)
 {
 
     char* instance_id = (*argv)[1];
@@ -78,9 +69,8 @@ void Process::set_data(int index, int *argc, char ***argv)
     msg_bar_t bar = smpi_deployment_finalization_barrier(instance_id);
     if (bar!=nullptr) // don't overwrite the default one
       finalization_barrier_ = bar;
-    index_       = index;
     instance_id_ = instance_id;
-    replaying_   = false;
+    index_ = index;
 
     static_cast<simgrid::MsgActorExt*>(SIMIX_process_self()->data)->data = this;
 
@@ -95,21 +85,15 @@ void Process::set_data(int index, int *argc, char ***argv)
     // set the process attached to the mailbox
     mailbox_small_->setReceiver(simgrid::s4u::Actor::self());
     process_ = SIMIX_process_self();
-    XBT_DEBUG("<%d> New process in the game: %p", index, SIMIX_process_self());
+    XBT_DEBUG("<%d> New process in the game: %p", index_, SIMIX_process_self());
 }
 
-void Process::destroy()
+/** @brief Prepares the current process for termination. */
+void Process::finalize()
 {
-  if(smpi_privatize_global_variables){
-    smpi_switch_data_segment(index_);
-  }
   state_ = SMPI_FINALIZED;
   XBT_DEBUG("<%d> Process left the game", index_);
-}
 
-/** @brief Prepares the current process for termination. */
-void Process::finalize()
-{
     // This leads to an explosion of the search graph which cannot be reduced:
     if(MC_is_active() || MC_record_replay_is_active())
       return;
@@ -155,16 +139,6 @@ bool Process::replaying(){
     return false;
 }
 
-void Process::set_user_data(void *data)
-{
-  data_ = data;
-}
-
-void *Process::get_user_data()
-{
-  return data_;
-}
-
 smx_actor_t Process::process(){
   return process_;
 }
@@ -299,7 +273,7 @@ void Process::init(int *argc, char ***argv){
     int rank = xbt_str_parse_int((*argv)[2], "Invalid rank: %s");
     smpi_deployment_register_process(instance_id, rank, index);
 
-    if(smpi_privatize_global_variables){
+    if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
       /* Now using segment index of the process  */
       index = proc->segment_index;
       /* Done at the process's creation */