Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convert enum smpi_process_state to enum class.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 25 May 2018 19:37:05 +0000 (21:37 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 27 May 2018 19:28:54 +0000 (21:28 +0200)
src/smpi/include/private.hpp
src/smpi/include/smpi_process.hpp
src/smpi/internals/smpi_process.cpp

index 697103d..4e1f6dd 100644 (file)
@@ -29,7 +29,7 @@
 #define MPI_REQ_RMA 0x200
 #define MPI_REQ_ACCUMULATE 0x400
 
 #define MPI_REQ_RMA 0x200
 #define MPI_REQ_ACCUMULATE 0x400
 
-enum smpi_process_state { SMPI_UNINITIALIZED, SMPI_INITIALIZED, SMPI_FINALIZED };
+enum class SmpiProcessState { UNINITIALIZED, INITIALIZED, FINALIZED };
 
 #define COLL_TAG_REDUCE -112
 #define COLL_TAG_SCATTER -223
 
 #define COLL_TAG_REDUCE -112
 #define COLL_TAG_SCATTER -223
index 7e55da0..e7c6772 100644 (file)
@@ -28,7 +28,7 @@ class Process {
     MPI_Comm comm_intra_  = MPI_COMM_NULL;
     MPI_Comm* comm_world_ = nullptr;
     void* data_           = nullptr; /* user data */
     MPI_Comm comm_intra_  = MPI_COMM_NULL;
     MPI_Comm* comm_world_ = nullptr;
     void* data_           = nullptr; /* user data */
-    char state_;
+    SmpiProcessState state_;
     int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
     std::string instance_id_;
     bool replaying_                 = false; /* is the process replaying a trace */
     int sampling_                   = 0; /* inside an SMPI_SAMPLE_ block? */
     std::string instance_id_;
     bool replaying_                 = false; /* is the process replaying a trace */
index 603c39e..d88c84b 100644 (file)
@@ -25,7 +25,7 @@ Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
   mailbox_small_   = simgrid::s4u::Mailbox::by_name("small-" + std::to_string(actor_->get_pid()));
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
   mailbox_small_   = simgrid::s4u::Mailbox::by_name("small-" + std::to_string(actor_->get_pid()));
   mailboxes_mutex_ = xbt_mutex_init();
   timer_           = xbt_os_timer_new();
-  state_           = SMPI_UNINITIALIZED;
+  state_           = SmpiProcessState::UNINITIALIZED;
   if (MC_is_active())
     MC_ignore_heap(timer_, xbt_os_timer_size());
 
   if (MC_is_active())
     MC_ignore_heap(timer_, xbt_os_timer_size());
 
@@ -84,7 +84,7 @@ void Process::set_data(int* argc, char*** argv)
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
-  state_ = SMPI_FINALIZED;
+  state_ = SmpiProcessState::FINALIZED;
   XBT_DEBUG("<%ld> Process left the game", actor_->get_pid());
 
   // This leads to an explosion of the search graph which cannot be reduced:
   XBT_DEBUG("<%ld> Process left the game", actor_->get_pid());
 
   // This leads to an explosion of the search graph which cannot be reduced:
@@ -97,7 +97,7 @@ void Process::finalize()
 /** @brief Check if a process is finalized */
 int Process::finalized()
 {
 /** @brief Check if a process is finalized */
 int Process::finalized()
 {
-  return (state_ == SMPI_FINALIZED);
+  return (state_ == SmpiProcessState::FINALIZED);
 }
 
 /** @brief Check if a process is initialized */
 }
 
 /** @brief Check if a process is initialized */
@@ -105,18 +105,18 @@ int Process::initialized()
 {
   // TODO cheinrich: Check if we still need this. This should be a global condition, not for a
   // single process ... ?
 {
   // TODO cheinrich: Check if we still need this. This should be a global condition, not for a
   // single process ... ?
-  return (state_ == SMPI_INITIALIZED);
+  return (state_ == SmpiProcessState::INITIALIZED);
 }
 
 /** @brief Mark a process as initialized (=MPI_Init called) */
 void Process::mark_as_initialized()
 {
 }
 
 /** @brief Mark a process as initialized (=MPI_Init called) */
 void Process::mark_as_initialized()
 {
-  if (state_ != SMPI_FINALIZED)
-    state_ = SMPI_INITIALIZED;
+  if (state_ != SmpiProcessState::FINALIZED)
+    state_ = SmpiProcessState::INITIALIZED;
 }
 
 void Process::set_replaying(bool value){
 }
 
 void Process::set_replaying(bool value){
-  if (state_ != SMPI_FINALIZED)
+  if (state_ != SmpiProcessState::FINALIZED)
     replaying_ = value;
 }
 
     replaying_ = value;
 }