Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to cleanup how MPI process are created. First act.
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 11 Apr 2017 17:17:45 +0000 (19:17 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 11 Apr 2017 17:17:45 +0000 (19:17 +0200)
src/smpi/smpi_process.cpp
src/smpi/smpi_process.hpp

index fbf586f..142db9e 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') {
@@ -80,7 +71,6 @@ void Process::set_data(int index, int *argc, char ***argv)
       finalization_barrier_ = bar;
     index_       = index;
     instance_id_ = instance_id;
-    replaying_   = false;
 
     static_cast<simgrid::MsgActorExt*>(SIMIX_process_self()->data)->data = this;
 
index f31e8dd..bad4bb2 100644 (file)
@@ -18,26 +18,26 @@ namespace smpi{
 
 class Process {
   private:
-    double simulated_;
-    int *argc_;
-    char ***argv_;
+    double simulated_ = 0 /* Used to time with simulated_start/elapsed */;
+    int* argc_        = nullptr;
+    char*** argv_     = nullptr;
     simgrid::s4u::MailboxPtr mailbox_;
     simgrid::s4u::MailboxPtr mailbox_small_;
     xbt_mutex_t mailboxes_mutex_;
     xbt_os_timer_t timer_;
-    MPI_Comm comm_self_;
-    MPI_Comm comm_intra_;
-    MPI_Comm* comm_world_;
-    void *data_;                   /* user data */
-    int index_;
+    MPI_Comm comm_self_   = MPI_COMM_NULL;
+    MPI_Comm comm_intra_  = MPI_COMM_NULL;
+    MPI_Comm* comm_world_ = nullptr;
+    void* data_           = nullptr; /* user data */
+    int index_            = MPI_UNDEFINED;
     char state_;
-    int sampling_;                 /* inside an SMPI_SAMPLE_ block? */
-    char* instance_id_;
-    bool replaying_;                /* is the process replaying a trace */
-    msg_bar_t finalization_barrier_;
-    int return_value_;
+    int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
+    char* instance_id_              = nullptr;
+    bool replaying_                 = false; /* is the process replaying a trace */
+    msg_bar_t finalization_barrier_ = nullptr;
+    int return_value_               = 0;
     smpi_trace_call_location_t trace_call_loc_;
-    smx_actor_t process_;
+    smx_actor_t process_ = nullptr;
 #if HAVE_PAPI
   /** Contains hardware data as read by PAPI **/
     int papi_event_set_;