Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mostly cosmetics
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 15 May 2017 14:53:23 +0000 (16:53 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 15 May 2017 15:01:07 +0000 (17:01 +0200)
src/kernel/context/ContextBoost.cpp
src/smpi/smpi_coll.hpp
src/smpi/smpi_utils.cpp
src/xbt/parmap.cpp
src/xbt/xbt_main.cpp

index 051dc6f..aa1ce97 100644 (file)
@@ -86,8 +86,8 @@ BoostContextFactory::~BoostContextFactory()
 #endif
 }
 
 #endif
 }
 
-smx_context_t BoostContextFactory::create_context(std::function<void()>  code,
-  void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
+smx_context_t BoostContextFactory::create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
+                                                  smx_actor_t process)
 {
   BoostContext* context = nullptr;
   if (BoostContext::parallel_)
 {
   BoostContext* context = nullptr;
   if (BoostContext::parallel_)
@@ -140,12 +140,11 @@ BoostContext::BoostContext(std::function<void()> code,
   : Context(std::move(code), cleanup_func, process)
 {
 
   : Context(std::move(code), cleanup_func, process)
 {
 
-  /* if the user provided a function for the process then use it,
-     otherwise it is the context for maestro */
+  /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
   if (has_code()) {
     this->stack_ = SIMIX_context_stack_new();
   if (has_code()) {
     this->stack_ = SIMIX_context_stack_new();
-    // We need to pass the bottom of the stack to make_fcontext,
-    // depending on the stack direction it may be the lower or higher address:
+// We need to pass the bottom of the stack to make_fcontext, depending on the stack direction it may be the lower
+// or higher address:
 #if PTH_STACKGROWTH == -1
     void* stack = static_cast<char*>(this->stack_) + smx_context_usable_stack_size - 1;
 #else
 #if PTH_STACKGROWTH == -1
     void* stack = static_cast<char*>(this->stack_) + smx_context_usable_stack_size - 1;
 #else
@@ -191,15 +190,15 @@ void BoostSerialContext::suspend()
 {
   /* determine the next context */
   BoostSerialContext* next_context = nullptr;
 {
   /* determine the next context */
   BoostSerialContext* next_context = nullptr;
-  unsigned long int i = process_index_++;
+  unsigned long int i              = process_index_;
+  process_index_++;
 
   if (i < xbt_dynar_length(simix_global->process_to_run)) {
     /* execute the next process */
     XBT_DEBUG("Run next process");
 
   if (i < xbt_dynar_length(simix_global->process_to_run)) {
     /* execute the next process */
     XBT_DEBUG("Run next process");
-    next_context = static_cast<BoostSerialContext*>(xbt_dynar_get_as(
-        simix_global->process_to_run, i, smx_actor_t)->context);
-  }
-  else {
+    next_context =
+        static_cast<BoostSerialContext*>(xbt_dynar_get_as(simix_global->process_to_run, i, smx_actor_t)->context);
+  } else {
     /* all processes were run, return to maestro */
     XBT_DEBUG("No more process to run");
     next_context = static_cast<BoostSerialContext*>(maestro_context_);
     /* all processes were run, return to maestro */
     XBT_DEBUG("No more process to run");
     next_context = static_cast<BoostSerialContext*>(maestro_context_);
@@ -230,11 +229,9 @@ void BoostParallelContext::suspend()
   if (next_work != nullptr) {
     XBT_DEBUG("Run next process");
     next_context = static_cast<BoostParallelContext*>(next_work->context);
   if (next_work != nullptr) {
     XBT_DEBUG("Run next process");
     next_context = static_cast<BoostParallelContext*>(next_work->context);
-  }
-  else {
+  } else {
     XBT_DEBUG("No more processes to run");
     XBT_DEBUG("No more processes to run");
-    uintptr_t worker_id =
-      (uintptr_t) xbt_os_thread_get_specific(worker_id_key_);
+    uintptr_t worker_id = (uintptr_t)xbt_os_thread_get_specific(worker_id_key_);
     next_context = static_cast<BoostParallelContext*>(workers_context_[worker_id]);
   }
 
     next_context = static_cast<BoostParallelContext*>(workers_context_[worker_id]);
   }
 
index 1f5dfa4..8410ae7 100644 (file)
@@ -36,8 +36,8 @@ static ret cat  (COLL_UNPAREN args); \
 
 #define COLL_APPLY(action, sig, name) action(sig, name)
 #define COLL_COMMA ,
 
 #define COLL_APPLY(action, sig, name) action(sig, name)
 #define COLL_COMMA ,
-#define COLL_NOsep 
-#define COLL_NOTHING(...) 
+#define COLL_NOsep
+#define COLL_NOTHING(...)
 
 #define COLL_GATHER_SIG gather, int, \
                       (void *send_buff, int send_count, MPI_Datatype send_type, \
 
 #define COLL_GATHER_SIG gather, int, \
                       (void *send_buff, int send_count, MPI_Datatype send_type, \
@@ -90,31 +90,30 @@ typedef struct mpi_coll_description  s_mpi_coll_description_t;
 
 class Colls{
   public:
 
 class Colls{
   public:
-
     static XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table);
     static XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc);
     static void set_collectives();
 
     static XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table);
     static XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t * table, const char *name, const char *desc);
     static void set_collectives();
 
-    // for each collective type, create the set_* prototype, the description array
-    // and the function pointer
-    COLL_APPLY(COLL_DEFS,COLL_GATHER_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_ALLGATHER_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_ALLGATHERV_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_REDUCE_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_ALLREDUCE_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_REDUCE_SCATTER_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_SCATTER_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_BARRIER_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_BCAST_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_ALLTOALL_SIG,"");
-    COLL_APPLY(COLL_DEFS,COLL_ALLTOALLV_SIG,"");
-
-//These fairly unused collectives only have one implementation in SMPI
-
-    static int gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
-    static int scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
-    static int scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
-    static int exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+    // for each collective type, create the set_* prototype, the description array and the function pointer
+    COLL_APPLY(COLL_DEFS, COLL_GATHER_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_ALLGATHER_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_ALLGATHERV_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_REDUCE_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_ALLREDUCE_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_REDUCE_SCATTER_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_SCATTER_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_BARRIER_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_BCAST_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_ALLTOALL_SIG, "");
+    COLL_APPLY(COLL_DEFS, COLL_ALLTOALLV_SIG, "");
+
+    // These fairly unused collectives only have one implementation in SMPI
+    static int gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs,
+                       MPI_Datatype recvtype, int root, MPI_Comm comm);
+    static int scatterv(void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, void* recvbuf,
+                        int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
+    static int scan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+    static int exscan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
 
     static void (*smpi_coll_cleanup_callback)();
 };
 
     static void (*smpi_coll_cleanup_callback)();
 };
@@ -239,7 +238,6 @@ COLL_ALLREDUCES(COLL_PROTO, COLL_NOsep)
  * ALLTOALL *
  ************/
 
  * ALLTOALL *
  ************/
 
-
 #define COLL_ALLTOALLS(action, COLL_sep) \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, default) COLL_sep \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
 #define COLL_ALLTOALLS(action, COLL_sep) \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, default) COLL_sep \
 COLL_APPLY(action, COLL_ALLTOALL_SIG, 2dmesh) COLL_sep \
@@ -322,7 +320,6 @@ COLL_APPLY(action, COLL_BCAST_SIG, automatic)
 
 COLL_BCASTS(COLL_PROTO, COLL_NOsep)
 
 
 COLL_BCASTS(COLL_PROTO, COLL_NOsep)
 
-
 /**********
  * REDUCE *
  **********/
 /**********
  * REDUCE *
  **********/
@@ -368,11 +365,8 @@ COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, mvapich2) COLL_sep \
 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, impi) COLL_sep \
 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic)
 
 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, impi) COLL_sep \
 COLL_APPLY(action, COLL_REDUCE_SCATTER_SIG, automatic)
 
-
-
 COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep)
 
 COLL_REDUCE_SCATTERS(COLL_PROTO, COLL_NOsep)
 
-
 /*************
  * SCATTER *
  *************/
 /*************
  * SCATTER *
  *************/
@@ -412,8 +406,6 @@ COLL_APPLY(action, COLL_BARRIER_SIG, automatic)
 
 COLL_BARRIERS(COLL_PROTO, COLL_NOsep)
 
 
 COLL_BARRIERS(COLL_PROTO, COLL_NOsep)
 
-
 }
 }
 }
 }
-
 #endif
 #endif
index 7f43538..91e01ce 100644 (file)
@@ -38,15 +38,14 @@ std::vector<s_smpi_factor_t> parse_factor(const char *smpi_coef_string)
       xbt_die("Malformed radical for smpi factor: '%s'", smpi_coef_string);
     }
     unsigned int iteration = 0;
       xbt_die("Malformed radical for smpi factor: '%s'", smpi_coef_string);
     }
     unsigned int iteration = 0;
-    for (Tokenizer::iterator factor_iter = factor_values.begin();
-         factor_iter != factor_values.end(); factor_iter++, iteration++) {
+    for (Tokenizer::iterator factor_iter = factor_values.begin(); factor_iter != factor_values.end(); factor_iter++) {
+      iteration++;
       char *errmsg;
 
       if (factor_iter == factor_values.begin()) { /* first element */
         errmsg = bprintf("Invalid factor in chunk #%zu: %%s", smpi_factor.size()+1);
         fact.factor = xbt_str_parse_int(factor_iter->c_str(), errmsg);
       char *errmsg;
 
       if (factor_iter == factor_values.begin()) { /* first element */
         errmsg = bprintf("Invalid factor in chunk #%zu: %%s", smpi_factor.size()+1);
         fact.factor = xbt_str_parse_int(factor_iter->c_str(), errmsg);
-      }
-      else {
+      } else {
         errmsg = bprintf("Invalid factor value %d in chunk #%zu: %%s", iteration, smpi_factor.size()+1);
         fact.values.push_back(xbt_str_parse_double(factor_iter->c_str(), errmsg));
       }
         errmsg = bprintf("Invalid factor value %d in chunk #%zu: %%s", iteration, smpi_factor.size()+1);
         fact.values.push_back(xbt_str_parse_double(factor_iter->c_str(), errmsg));
       }
index 67ed936..2a1851b 100644 (file)
@@ -218,6 +218,8 @@ static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
     case XBT_PARMAP_DEFAULT:
       THROW_IMPOSSIBLE;
       break;
     case XBT_PARMAP_DEFAULT:
       THROW_IMPOSSIBLE;
       break;
+    default:
+      THROW_IMPOSSIBLE;
   }
 }
 
   }
 }
 
index 9176b29..ce2bc71 100644 (file)
@@ -96,7 +96,7 @@ static void xbt_preinit(void) {
   xbt_log_preinit();
   xbt_os_thread_mod_preinit();
   xbt_dict_preinit();
   xbt_log_preinit();
   xbt_os_thread_mod_preinit();
   xbt_dict_preinit();
-   
+
   srand(seed);
 #ifndef _WIN32
   srand48(seed);
   srand(seed);
 #ifndef _WIN32
   srand48(seed);
@@ -106,7 +106,8 @@ static void xbt_preinit(void) {
 
 static void xbt_postexit(void)
 {
 
 static void xbt_postexit(void)
 {
-  if(!_sg_do_clean_atexit) return;
+  if (!_sg_do_clean_atexit)
+    return;
   xbt_initialized--;
   xbt_dict_postexit();
   xbt_os_thread_mod_postexit();
   xbt_initialized--;
   xbt_dict_postexit();
   xbt_os_thread_mod_postexit();
@@ -123,14 +124,15 @@ void xbt_init(int *argc, char **argv)
 {
   simgrid::xbt::installExceptionHandler();
 
 {
   simgrid::xbt::installExceptionHandler();
 
-  if (xbt_initialized++) {
-    XBT_DEBUG("XBT was initialized %d times.", xbt_initialized);
+  if (xbt_initialized) {
+    xbt_initialized++;
+    XBT_DEBUG("XBT has been initialized %d times.", xbt_initialized);
     return;
   }
 
   xbt_binary_name = xbt_strdup(argv[0]);
     return;
   }
 
   xbt_binary_name = xbt_strdup(argv[0]);
-  xbt_cmdline = xbt_dynar_new(sizeof(char*),NULL);
-  for (int i=0;i<*argc;i++)
+  xbt_cmdline     = xbt_dynar_new(sizeof(char*), NULL);
+  for (int i = 0; i < *argc; i++)
     xbt_dynar_push(xbt_cmdline,&(argv[i]));
   
   xbt_log_init(argc, argv);
     xbt_dynar_push(xbt_cmdline,&(argv[i]));
   
   xbt_log_init(argc, argv);
@@ -158,8 +160,7 @@ void xbt_abort(void)
   __gcov_flush();
 #endif
 #ifdef _WIN32
   __gcov_flush();
 #endif
 #ifdef _WIN32
-  /* It was said *in silence*.  We don't want to see the error message printed
-   * by the Microsoft's implementation of abort(). */
+  /* We said *in silence*. We don't want to see the error message printed by Microsoft's implementation of abort(). */
   raise(SIGABRT);
   signal(SIGABRT, SIG_DFL);
   raise(SIGABRT);
   raise(SIGABRT);
   signal(SIGABRT, SIG_DFL);
   raise(SIGABRT);