Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge commit '78f0dd861a9bb479f33b9494a2b4ed7b977288a4' into v3_10_x
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Nov 2013 16:41:59 +0000 (17:41 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Nov 2013 16:41:59 +0000 (17:41 +0100)
15 files changed:
buildtools/Cmake/Flags.cmake
examples/smpi/MM/Summa.c
src/include/surf/maxmin.h
src/simgrid/sg_config.c
src/simix/smx_context.c
src/simix/smx_network.c
src/simix/smx_network_private.h
src/smpi/colls/allgatherv-mpich-rdb.c
src/smpi/colls/reduce-scatter-gather.c
src/surf/maxmin.c
src/xbt/dict.c
src/xbt/dict_cursor.c
src/xbt/dynar.c
src/xbt/fifo.c
teshsuite/smpi/mpich3-test/datatype/large-count.c

index 68cae01..4c1178d 100644 (file)
@@ -11,12 +11,12 @@ else()
 endif()
 
 if(enable_compile_warnings)
-  set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wclobbered -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror -Wno-error=clobbered ")
-  if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5")
-    set(warnCFLAGS "${warnCFLAGS}-Wno-error=unused-but-set-variable ")
-  endif()
-  if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
-    string(REPLACE "-Wclobbered " "" warnCFLAGS "${warnCFLAGS}")
+  set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
+  if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+    set(warnCFLAGS "${warnCFLAGS}-Wclobbered -Wno-error=clobbered ")
+    if(COMPILER_C_VERSION_MAJOR_MINOR STRGREATER "4.5")
+      set(warnCFLAGS "${warnCFLAGS}-Wno-error=unused-but-set-variable ")
+    endif()
   endif()
 
   set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall") # FIXME: Q&D hack
index a53ac43..b2fb9aa 100644 (file)
  XBT_LOG_NEW_DEFAULT_CATEGORY(MM_Summa,
                              "Messages specific for this msg example");
 
-inline double Summa(
-                     double *a, double *b, double *c,
-                     size_t lda, size_t ldb, size_t ldc,
-                     size_t m, size_t k_a, size_t k_b, size_t n,
-                     size_t Block_size, size_t start, size_t end,
-                     size_t row, size_t col, size_t size_row, size_t size_col,
-                     double *a_local, double *b_local,
-                     MPI_Datatype Block_a, MPI_Datatype Block_a_local,
-                     MPI_Datatype Block_b,
-                     MPI_Comm row_comm, MPI_Comm col_comm, int subs)
+double Summa(double *a, double *b, double *c,
+             size_t lda, size_t ldb, size_t ldc,
+             size_t m, size_t k_a, size_t k_b, size_t n,
+             size_t Block_size, size_t start, size_t end,
+             size_t row, size_t col, size_t size_row, size_t size_col,
+             double *a_local, double *b_local,
+             MPI_Datatype Block_a, MPI_Datatype Block_a_local,
+             MPI_Datatype Block_b,
+             MPI_Comm row_comm, MPI_Comm col_comm, int subs)
 {
   double *B_a     , *B_b     ; //matrix blocks
   size_t err;
index 0db88a3..acd57fb 100644 (file)
@@ -33,7 +33,6 @@ static XBT_INLINE int double_equals(double value1, double value2)
 
 XBT_PUBLIC(lmm_system_t) lmm_system_new(int selective_update);
 XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys);
-void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
 
 XBT_PUBLIC(lmm_constraint_t) lmm_constraint_new(lmm_system_t sys, void *id,
                                                 double bound_value);
index 58f791d..0f88330 100644 (file)
@@ -611,12 +611,12 @@ void sg_config_init(int *argc, char **argv)
             "Context factory to use in SIMIX. Possible values: thread");
     const char *dflt_ctx_fact = "thread";
 #ifdef CONTEXT_UCONTEXT
-    strcat(description, ", ucontext");
     dflt_ctx_fact = "ucontext";
+    strcat(strcat(description, ", "), dflt_ctx_fact);
 #endif
 #ifdef HAVE_RAWCTX
-    strcat(description, ", raw");
     dflt_ctx_fact = "raw";
+    strcat(strcat(description, ", "), dflt_ctx_fact);
 #endif
     strcat(description, ".");
     xbt_cfg_register(&_sg_cfg_set, "contexts/factory", description,
index e638bb7..707cf77 100644 (file)
@@ -127,7 +127,7 @@ XBT_INLINE int SIMIX_context_get_nthreads(void) {
  *
  * \param nb_threads the number of threads to use
  */
-XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) {
+void SIMIX_context_set_nthreads(int nb_threads) {
   if (nb_threads<=0) {  
      nb_threads = xbt_os_get_numcores();
      XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads);
index 0cb33eb..7f9689a 100644 (file)
@@ -26,6 +26,7 @@ static smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
                                         int (*match_fun)(void *, void *,smx_action_t),
                                         void *user_data, smx_action_t my_action);
 static void SIMIX_rdv_free(void *data);
+static void SIMIX_comm_start(smx_action_t action);
 
 void SIMIX_network_init(void)
 {
@@ -835,7 +836,7 @@ void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall)
  *  \brief Starts the simulation of a communication action.
  *  \param action the communication action
  */
-XBT_INLINE void SIMIX_comm_start(smx_action_t action)
+static XBT_INLINE void SIMIX_comm_start(smx_action_t action)
 {
   /* If both the sender and the receiver are already there, start the communication */
   if (action->state == SIMIX_READY) {
index 72bcffa..fecdd3e 100644 (file)
@@ -34,7 +34,6 @@ int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
 smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv);
 void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t proc);
 smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv);
-void SIMIX_comm_start(smx_action_t action);
 smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
                               double task_size, double rate,
                               void *src_buff, size_t src_buff_size,
index 8391807..8094db0 100644 (file)
         /* Short or medium size message and power-of-two no. of processes. Use
-         * recursive doubling algorithm */   
+         * recursive doubling algorithm */
 #include "colls_private.h"
-int smpi_coll_tuned_allgatherv_mpich_rdb ( 
-    void *sendbuf,
-    int sendcount,
-    MPI_Datatype sendtype,
-    void *recvbuf,
-    int *recvcounts,
-    int *displs,
-    MPI_Datatype recvtype,
-    MPI_Comm comm)
+int smpi_coll_tuned_allgatherv_mpich_rdb (
+  void *sendbuf,
+  int sendcount,
+  MPI_Datatype sendtype,
+  void *recvbuf,
+  int *recvcounts,
+  int *displs,
+  MPI_Datatype recvtype,
+  MPI_Comm comm)
 {
-    int        comm_size, rank, j, i;
-    MPI_Status status;
-    MPI_Aint  recvtype_extent, recvtype_true_extent, recvtype_true_lb;
-    int curr_cnt, dst, total_count; 
-    void *tmp_buf;
-    int mask, dst_tree_root, my_tree_root, is_homogeneous, position,  
-        send_offset, recv_offset, last_recv_cnt=0, nprocs_completed, k,
-        offset, tmp_mask, tree_root;
-
-    comm_size = smpi_comm_size(comm);
-    rank = smpi_comm_rank(comm);
-    
-    total_count = 0;
-    for (i=0; i<comm_size; i++)
-        total_count += recvcounts[i];
-
-    if (total_count == 0) return MPI_ERR_COUNT;
-    
-    recvtype_extent=smpi_datatype_get_extent( recvtype);
-
-        is_homogeneous = 1;
-        
-        if (is_homogeneous) {
-            /* need to receive contiguously into tmp_buf because
-               displs could make the recvbuf noncontiguous */
-
-            smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent);
-
-            tmp_buf= (void*)xbt_malloc(total_count*(max(recvtype_true_extent,recvtype_extent)));
-
-            /* adjust for potential negative lower bound in datatype */
-            tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb);
-
-            /* copy local data into right location in tmp_buf */ 
-            position = 0;
-            for (i=0; i<rank; i++) position += recvcounts[i];
-            if (sendbuf != MPI_IN_PLACE)
-           {
-                smpi_datatype_copy(sendbuf, sendcount, sendtype,
-                                           ((char *)tmp_buf + position*
-                                            recvtype_extent), 
-                                           recvcounts[rank], recvtype);
-           }
-            else
-           {
-                /* if in_place specified, local data is found in recvbuf */ 
-                smpi_datatype_copy(((char *)recvbuf +
-                                            displs[rank]*recvtype_extent), 
-                                           recvcounts[rank], recvtype,
-                                           ((char *)tmp_buf + position*
-                                            recvtype_extent), 
-                                           recvcounts[rank], recvtype);
+  int        comm_size, rank, j, i;
+  MPI_Status status;
+  MPI_Aint  recvtype_extent, recvtype_true_extent, recvtype_true_lb;
+  int curr_cnt, dst, total_count;
+  void *tmp_buf;
+  int mask, dst_tree_root, my_tree_root, position,
+    send_offset, recv_offset, last_recv_cnt=0, nprocs_completed, k,
+    offset, tmp_mask, tree_root;
+
+  comm_size = smpi_comm_size(comm);
+  rank = smpi_comm_rank(comm);
+
+  total_count = 0;
+  for (i=0; i<comm_size; i++)
+    total_count += recvcounts[i];
+
+  if (total_count == 0) return MPI_ERR_COUNT;
+
+  recvtype_extent=smpi_datatype_get_extent( recvtype);
+
+  /* need to receive contiguously into tmp_buf because
+     displs could make the recvbuf noncontiguous */
+
+  smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent);
+
+  tmp_buf= (void*)xbt_malloc(total_count*(max(recvtype_true_extent,recvtype_extent)));
+
+  /* adjust for potential negative lower bound in datatype */
+  tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb);
+
+  /* copy local data into right location in tmp_buf */
+  position = 0;
+  for (i=0; i<rank; i++) position += recvcounts[i];
+  if (sendbuf != MPI_IN_PLACE)
+  {
+    smpi_datatype_copy(sendbuf, sendcount, sendtype,
+                       ((char *)tmp_buf + position*
+                        recvtype_extent),
+                       recvcounts[rank], recvtype);
+  }
+  else
+  {
+    /* if in_place specified, local data is found in recvbuf */
+    smpi_datatype_copy(((char *)recvbuf +
+                        displs[rank]*recvtype_extent),
+                       recvcounts[rank], recvtype,
+                       ((char *)tmp_buf + position*
+                        recvtype_extent),
+                       recvcounts[rank], recvtype);
+  }
+  curr_cnt = recvcounts[rank];
+
+  mask = 0x1;
+  i = 0;
+  while (mask < comm_size) {
+    dst = rank ^ mask;
+
+    /* find offset into send and recv buffers. zero out
+       the least significant "i" bits of rank and dst to
+       find root of src and dst subtrees. Use ranks of
+       roots as index to send from and recv into buffer */
+
+    dst_tree_root = dst >> i;
+    dst_tree_root <<= i;
+
+    my_tree_root = rank >> i;
+    my_tree_root <<= i;
+
+    if (dst < comm_size) {
+      send_offset = 0;
+      for (j=0; j<my_tree_root; j++)
+        send_offset += recvcounts[j];
+
+      recv_offset = 0;
+      for (j=0; j<dst_tree_root; j++)
+        recv_offset += recvcounts[j];
+
+      smpi_mpi_sendrecv(((char *)tmp_buf + send_offset * recvtype_extent),
+                        curr_cnt, recvtype, dst,
+                        COLL_TAG_ALLGATHERV,
+                        ((char *)tmp_buf + recv_offset * recvtype_extent),
+                        total_count - recv_offset, recvtype, dst,
+                        COLL_TAG_ALLGATHERV,
+                        comm, &status);
+      /* for convenience, recv is posted for a bigger amount
+         than will be sent */
+      last_recv_cnt=smpi_mpi_get_count(&status, recvtype);
+      curr_cnt += last_recv_cnt;
     }
-            curr_cnt = recvcounts[rank];
-            
-            mask = 0x1;
-            i = 0;
-            while (mask < comm_size) {
-                dst = rank ^ mask;
-                
-                /* find offset into send and recv buffers. zero out 
-                   the least significant "i" bits of rank and dst to 
-                   find root of src and dst subtrees. Use ranks of 
-                   roots as index to send from and recv into buffer */ 
-                
-                dst_tree_root = dst >> i;
-                dst_tree_root <<= i;
-                
-                my_tree_root = rank >> i;
-                my_tree_root <<= i;
-                
-                if (dst < comm_size) {
-                    send_offset = 0;
-                    for (j=0; j<my_tree_root; j++)
-                        send_offset += recvcounts[j];
-                    
-                    recv_offset = 0;
-                    for (j=0; j<dst_tree_root; j++)
-                        recv_offset += recvcounts[j];
-
-                    smpi_mpi_sendrecv(((char *)tmp_buf + send_offset * recvtype_extent),
-                                                 curr_cnt, recvtype, dst,
-                                                 COLL_TAG_ALLGATHERV,
-                                                 ((char *)tmp_buf + recv_offset * recvtype_extent),
-                                                 total_count - recv_offset, recvtype, dst,
-                                                 COLL_TAG_ALLGATHERV,
-                                                 comm, &status);
-                        /* for convenience, recv is posted for a bigger amount
-                           than will be sent */
-                        last_recv_cnt=smpi_mpi_get_count(&status, recvtype);
-                    curr_cnt += last_recv_cnt;
-                }
-                
-                /* if some processes in this process's subtree in this step
-                   did not have any destination process to communicate with
-                   because of non-power-of-two, we need to send them the
-                   data that they would normally have received from those
-                   processes. That is, the haves in this subtree must send to
-                   the havenots. We use a logarithmic
-                   recursive-halfing algorithm for this. */
-                
-                /* This part of the code will not currently be
-                 executed because we are not using recursive
-                 doubling for non power of two. Mark it as experimental
-                 so that it doesn't show up as red in the coverage
-                 tests. */  
-
-               /* --BEGIN EXPERIMENTAL-- */
-                if (dst_tree_root + mask > comm_size) {
-                    nprocs_completed = comm_size - my_tree_root - mask;
-                    /* nprocs_completed is the number of processes in this
-                       subtree that have all the data. Send data to others
-                       in a tree fashion. First find root of current tree
-                       that is being divided into two. k is the number of
-                       least-significant bits in this process's rank that
-                       must be zeroed out to find the rank of the root */ 
-                    j = mask;
-                    k = 0;
-                    while (j) {
-                        j >>= 1;
-                        k++;
-                    }
-                    k--;
-                    
-                    tmp_mask = mask >> 1;
-                    
-                    while (tmp_mask) {
-                        dst = rank ^ tmp_mask;
-                        
-                        tree_root = rank >> k;
-                        tree_root <<= k;
-                        
-                        /* send only if this proc has data and destination
-                           doesn't have data. at any step, multiple processes
-                           can send if they have the data */
-                        if ((dst > rank) && 
-                            (rank < tree_root + nprocs_completed)
-                            && (dst >= tree_root + nprocs_completed)) {
-
-                            offset = 0;
-                            for (j=0; j<(my_tree_root+mask); j++)
-                                offset += recvcounts[j];
-                            offset *= recvtype_extent;
-
-                            smpi_mpi_send(((char *)tmp_buf + offset),
-                                                     last_recv_cnt,
-                                                     recvtype, dst,
-                                                     COLL_TAG_ALLGATHERV, comm);
-                            /* last_recv_cnt was set in the previous
-                               receive. that's the amount of data to be
-                               sent now. */
-                        }
-                        /* recv only if this proc. doesn't have data and sender
-                           has data */
-                        else if ((dst < rank) && 
-                                 (dst < tree_root + nprocs_completed) &&
-                                 (rank >= tree_root + nprocs_completed)) {
-
-                            offset = 0;
-                            for (j=0; j<(my_tree_root+mask); j++)
-                                offset += recvcounts[j];
-
-                            smpi_mpi_recv(((char *)tmp_buf + offset * recvtype_extent),
-                                                     total_count - offset, recvtype,
-                                                     dst, COLL_TAG_ALLGATHERV,
-                                                     comm, &status);
-                                /* for convenience, recv is posted for a
-                                   bigger amount than will be sent */
-                                last_recv_cnt=smpi_mpi_get_count(&status, recvtype);
-                            curr_cnt += last_recv_cnt;
-                        }
-                        tmp_mask >>= 1;
-                        k--;
-                    }
-                }
-               /* --END EXPERIMENTAL-- */
-                
-                mask <<= 1;
-                i++;
-            }
-
-            /* copy data from tmp_buf to recvbuf */
-            position = 0;
-            for (j=0; j<comm_size; j++) {
-                if ((sendbuf != MPI_IN_PLACE) || (j != rank)) {
-                    /* not necessary to copy if in_place and
-                       j==rank. otherwise copy. */
-                    smpi_datatype_copy(((char *)tmp_buf + position*recvtype_extent),
-                                               recvcounts[j], recvtype,
-                                               ((char *)recvbuf + displs[j]*recvtype_extent),
-                                               recvcounts[j], recvtype);
-                }
-                position += recvcounts[j];
-            }
+
+    /* if some processes in this process's subtree in this step
+       did not have any destination process to communicate with
+       because of non-power-of-two, we need to send them the
+       data that they would normally have received from those
+       processes. That is, the haves in this subtree must send to
+       the havenots. We use a logarithmic
+       recursive-halfing algorithm for this. */
+
+    /* This part of the code will not currently be
+       executed because we are not using recursive
+       doubling for non power of two. Mark it as experimental
+       so that it doesn't show up as red in the coverage
+       tests. */
+
+    /* --BEGIN EXPERIMENTAL-- */
+    if (dst_tree_root + mask > comm_size) {
+      nprocs_completed = comm_size - my_tree_root - mask;
+      /* nprocs_completed is the number of processes in this
+         subtree that have all the data. Send data to others
+         in a tree fashion. First find root of current tree
+         that is being divided into two. k is the number of
+         least-significant bits in this process's rank that
+         must be zeroed out to find the rank of the root */
+      j = mask;
+      k = 0;
+      while (j) {
+        j >>= 1;
+        k++;
+      }
+      k--;
+
+      tmp_mask = mask >> 1;
+
+      while (tmp_mask) {
+        dst = rank ^ tmp_mask;
+
+        tree_root = rank >> k;
+        tree_root <<= k;
+
+        /* send only if this proc has data and destination
+           doesn't have data. at any step, multiple processes
+           can send if they have the data */
+        if ((dst > rank) &&
+            (rank < tree_root + nprocs_completed)
+            && (dst >= tree_root + nprocs_completed)) {
+
+          offset = 0;
+          for (j=0; j<(my_tree_root+mask); j++)
+            offset += recvcounts[j];
+          offset *= recvtype_extent;
+
+          smpi_mpi_send(((char *)tmp_buf + offset),
+                        last_recv_cnt,
+                        recvtype, dst,
+                        COLL_TAG_ALLGATHERV, comm);
+          /* last_recv_cnt was set in the previous
+             receive. that's the amount of data to be
+             sent now. */
         }
+        /* recv only if this proc. doesn't have data and sender
+           has data */
+        else if ((dst < rank) &&
+                 (dst < tree_root + nprocs_completed) &&
+                 (rank >= tree_root + nprocs_completed)) {
+
+          offset = 0;
+          for (j=0; j<(my_tree_root+mask); j++)
+            offset += recvcounts[j];
+
+          smpi_mpi_recv(((char *)tmp_buf + offset * recvtype_extent),
+                        total_count - offset, recvtype,
+                        dst, COLL_TAG_ALLGATHERV,
+                        comm, &status);
+          /* for convenience, recv is posted for a
+             bigger amount than will be sent */
+          last_recv_cnt=smpi_mpi_get_count(&status, recvtype);
+          curr_cnt += last_recv_cnt;
+        }
+        tmp_mask >>= 1;
+        k--;
+      }
+    }
+    /* --END EXPERIMENTAL-- */
+
+    mask <<= 1;
+    i++;
+  }
+
+  /* copy data from tmp_buf to recvbuf */
+  position = 0;
+  for (j=0; j<comm_size; j++) {
+    if ((sendbuf != MPI_IN_PLACE) || (j != rank)) {
+      /* not necessary to copy if in_place and
+         j==rank. otherwise copy. */
+      smpi_datatype_copy(((char *)tmp_buf + position*recvtype_extent),
+                         recvcounts[j], recvtype,
+                         ((char *)recvbuf + displs[j]*recvtype_extent),
+                         recvcounts[j], recvtype);
+    }
+    position += recvcounts[j];
+  }
+
   free(tmp_buf);
   return MPI_SUCCESS;
 }
index 19c6794..af317fb 100644 (file)
@@ -216,7 +216,7 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
   }
 
 
-  else if (count >= comm_size) {
+  else /* (count >= comm_size) */ {
     tmp_buf = (void *) xbt_malloc(count * extent);
 
     //if ((rank != root))
index feef80b..420695c 100644 (file)
@@ -93,7 +93,7 @@ void lmm_system_free(lmm_system_t sys)
   free(sys);
 }
 
-XBT_INLINE void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var)
+static XBT_INLINE void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var)
 {
   int i;
   int n;
index be839e3..3984e43 100644 (file)
@@ -171,8 +171,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
   xbt_dictelm_t current, previous = NULL;
   xbt_assert(dict);
 
-  XBT_DEBUG("ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
-         dict->table_size, hash_code & dict->table_size);
+  XBT_CDEBUG(xbt_dict,
+             "ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
+             dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
          (hash_code != current->hash_code || key_len != current->key_len
@@ -194,9 +195,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
       previous->next = current;
     }
   } else {
-    XBT_DEBUG("Replace %.*s by %.*s under key %.*s",
-           key_len, (char *) current->content,
-           key_len, (char *) data, key_len, (char *) key);
+    XBT_CDEBUG(xbt_dict, "Replace %.*s by %.*s under key %.*s",
+               key_len, (char *) current->content,
+               key_len, (char *) data, key_len, (char *) key);
     /* there is already an element with the same key: overwrite it */
     xbt_dictelm_set_data(dict, current, data, free_ctn);
   }
index 790536c..c39e65d 100644 (file)
@@ -81,9 +81,9 @@ XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
 XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict,
                                       xbt_dict_cursor_t * cursor)
 {
-  XBT_DEBUG("xbt_dict_cursor_first");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_first");
   if (!*cursor) {
-    XBT_DEBUG("Create the cursor on first use");
+    XBT_CDEBUG(xbt_dict_cursor, "Create the cursor on first use");
     *cursor = xbt_dict_cursor_new(dict);
   } else {
     xbt_dict_cursor_rewind(*cursor);
@@ -102,7 +102,7 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
   xbt_dictelm_t current;
   int line;
 
-  XBT_DEBUG("xbt_dict_cursor_step");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_step");
   xbt_assert(cursor);
 
   current = cursor->current;
@@ -111,17 +111,17 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
   if (cursor->dict != NULL) {
 
     if (current != NULL) {
-      XBT_DEBUG("current is not null, take the next element");
+      XBT_CDEBUG(xbt_dict_cursor, "current is not null, take the next element");
       current = current->next;
-      XBT_DEBUG("next element: %p", current);
+      XBT_CDEBUG(xbt_dict_cursor, "next element: %p", current);
     }
 
     while (current == NULL && ++line <= cursor->dict->table_size) {
-      XBT_DEBUG("current is NULL, take the next line");
+      XBT_CDEBUG(xbt_dict_cursor, "current is NULL, take the next line");
       current = cursor->dict->table[line];
-      XBT_DEBUG("element in the next line: %p", current);
+      XBT_CDEBUG(xbt_dict_cursor, "element in the next line: %p", current);
     }
-    XBT_DEBUG("search finished, current = %p, line = %d", current, line);
+    XBT_CDEBUG(xbt_dict_cursor, "search finished, current = %p, line = %d", current, line);
 
     cursor->current = current;
     cursor->line = line;
@@ -139,7 +139,7 @@ XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor,
 
   xbt_dictelm_t current;
 
-  XBT_DEBUG("xbt_dict_get_or_free");
+  XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free");
 
 
   if (!cursor || !(*cursor))
index 7517190..d9e20b9 100644 (file)
@@ -149,7 +149,7 @@ XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar)
 {
   _sanity_check_dynar(dynar);
 
-  XBT_DEBUG("Reset the dynar %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Reset the dynar %p", (void *) dynar);
   if (dynar->free_f) {
     xbt_dynar_map(dynar, dynar->free_f);
   }
@@ -557,7 +557,7 @@ XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar,
 XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 {
   _check_populated_dynar(dynar);
-  XBT_DEBUG("Pop %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
   dynar->used--;
   return _xbt_dynar_elm(dynar, dynar->used);
 }
@@ -567,7 +567,7 @@ XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst)
 {
 
   /* sanity checks done by remove_at */
-  XBT_DEBUG("Pop %p", (void *) dynar);
+  XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
   xbt_dynar_remove_at(dynar, dynar->used - 1, dst);
 }
 
@@ -707,7 +707,7 @@ XBT_INLINE void * xbt_dynar_to_array (xbt_dynar_t dynar)
 /*
  * Return 0 if d1 and d2 are equal and 1 if not equal
  */
-XBT_INLINE int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2,
+int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2,
           int(*compar)(const void *, const void *))
 {
   int i ;
index e28cc7e..adaa88d 100644 (file)
@@ -429,7 +429,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void)
  */
 XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_new_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_new_item.");
   return xbt_fifo_new_item();
 }
 
@@ -469,7 +469,7 @@ XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b)
  */
 XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_free_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_free_item.");
   xbt_fifo_free_item(b);
   return;
 }
@@ -509,7 +509,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l)
  */
 XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_get_first_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_first_item.");
   return xbt_fifo_get_first_item(l);
 }
 
@@ -530,7 +530,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
  */
 xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
 {
-  XBT_WARN("This function is deprecated. Use xbt_fifo_get_next_item.");
+  XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_next_item.");
   return xbt_fifo_get_next_item(i);
 }
 
index 31f6a2d..c27a31d 100644 (file)
@@ -13,6 +13,8 @@
 #include <stdlib.h>
 #include <mpi.h>
 
+#define equals(a, b) ((long long)(a) == (long long)(b))
+
 /* assert-like macro that bumps the err count and emits a message */
 #define check(x_)                                                                 \
     do {                                                                          \
@@ -95,89 +97,89 @@ int main(int argc, char *argv[])
 
     /* MPI_Type_size */
     MPI_Type_size(imax_contig, &size);
-    check(size == INT_MAX);
+    check(equals(size, INT_MAX));
     MPI_Type_size(four_ints, &size);
-    check(size == 4*sizeof(int));
+    check(equals(size, 4*sizeof(int)));
     MPI_Type_size(imx4i, &size);
-    check(size == MPI_UNDEFINED); /* should overflow an int */
+    check(equals(size, MPI_UNDEFINED)); /* should overflow an int */
     MPI_Type_size(imx4i_rsz, &size);
-    check(size == MPI_UNDEFINED); /* should overflow an int */
+    check(equals(size, MPI_UNDEFINED)); /* should overflow an int */
 
     /* MPI_Type_size_x */
     MPI_Type_size_x(imax_contig, &size_x);
-    check(size_x == INT_MAX);
+    check(equals(size_x, INT_MAX));
     MPI_Type_size_x(four_ints, &size_x);
-    check(size_x == 4*sizeof(int));
+    check(equals(size_x, 4*sizeof(int)));
     MPI_Type_size_x(imx4i, &size_x);
-    check(size_x == 4LL*sizeof(int)*(INT_MAX/2)); /* should overflow an int */
+    check(equals(size_x, 4LL*sizeof(int)*(INT_MAX/2))); /* should overflow an int */
     MPI_Type_size_x(imx4i_rsz, &size_x);
-    check(size_x == 4LL*sizeof(int)*(INT_MAX/2)); /* should overflow an int */
+    check(equals(size_x, 4LL*sizeof(int)*(INT_MAX/2))); /* should overflow an int */
 
     /* MPI_Type_get_extent */
     MPI_Type_get_extent(imax_contig, &lb, &extent);
-    check(lb == 0);
-    check(extent == INT_MAX);
+    check(equals(lb, 0));
+    check(equals(extent, INT_MAX));
     MPI_Type_get_extent(four_ints, &lb, &extent);
-    check(lb == 0);
-    check(extent == 4*sizeof(int));
+    check(equals(lb, 0));
+    check(equals(extent, 4*sizeof(int)));
     MPI_Type_get_extent(imx4i, &lb, &extent);
-    check(lb == 0);
+    check(equals(lb, 0));
     if (sizeof(MPI_Aint) == sizeof(int))
-        check(extent == MPI_UNDEFINED);
+        check(equals(extent, MPI_UNDEFINED));
     else
-        check(extent == imx4i_true_extent);
+        check(equals(extent, imx4i_true_extent));
 
     MPI_Type_get_extent(imx4i_rsz, &lb, &extent);
-    check(lb == INT_MAX);
-    check(extent == -1024);
+    check(equals(lb, INT_MAX));
+    check(equals(extent, -1024));
 
     /* MPI_Type_get_extent_x */
     MPI_Type_get_extent_x(imax_contig, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == INT_MAX);
+    check(equals(lb_x, 0));
+    check(equals(extent_x, INT_MAX));
     MPI_Type_get_extent_x(four_ints, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == 4*sizeof(int));
+    check(equals(lb_x, 0));
+    check(equals(extent_x, 4*sizeof(int)));
     MPI_Type_get_extent_x(imx4i, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == imx4i_true_extent);
+    check(equals(lb_x, 0));
+    check(equals(extent_x, imx4i_true_extent));
     MPI_Type_get_extent_x(imx4i_rsz, &lb_x, &extent_x);
-    check(lb_x == INT_MAX);
-    check(extent_x == -1024);
+    check(equals(lb_x, INT_MAX));
+    check(equals(extent_x, -1024));
 
     /* MPI_Type_get_true_extent */
     MPI_Type_get_true_extent(imax_contig, &lb, &extent);
-    check(lb == 0);
-    check(extent == INT_MAX);
+    check(equals(lb, 0));
+    check(equals(extent, INT_MAX));
     MPI_Type_get_true_extent(four_ints, &lb, &extent);
-    check(lb == 0);
-    check(extent == 4*sizeof(int));
+    check(equals(lb, 0));
+    check(equals(extent, 4*sizeof(int)));
     MPI_Type_get_true_extent(imx4i, &lb, &extent);
-    check(lb == 0);
+    check(equals(lb, 0));
     if (sizeof(MPI_Aint) == sizeof(int))
-        check(extent == MPI_UNDEFINED);
+        check(equals(extent, MPI_UNDEFINED));
     else
-        check(extent == imx4i_true_extent);
+        check(equals(extent, imx4i_true_extent));
     MPI_Type_get_true_extent(imx4i_rsz, &lb, &extent);
-    check(lb == 0);
+    check(equals(lb, 0));
     if (sizeof(MPI_Aint) == sizeof(int))
-        check(extent == MPI_UNDEFINED);
+        check(equals(extent, MPI_UNDEFINED));
     else
-        check(extent == imx4i_true_extent);
+        check(equals(extent, imx4i_true_extent));
 
     /* MPI_Type_get_true_extent_x */
     MPI_Type_get_true_extent_x(imax_contig, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == INT_MAX);
+    check(equals(lb_x, 0));
+    check(equals(extent_x, INT_MAX));
     MPI_Type_get_true_extent_x(four_ints, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == 4*sizeof(int));
+    check(equals(lb_x, 0));
+    check(equals(extent_x, 4*sizeof(int)));
     MPI_Type_get_true_extent_x(imx4i, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == imx4i_true_extent);
+    check(equals(lb_x, 0));
+    check(equals(extent_x, imx4i_true_extent));
     MPI_Type_get_true_extent_x(imx4i_rsz, &lb_x, &extent_x);
-    check(lb_x == 0);
-    check(extent_x == imx4i_true_extent);
+    check(equals(lb_x, 0));
+    check(equals(extent_x, imx4i_true_extent));
 
 
     /* MPI_{Status_set_elements,Get_elements}{,_x} */
@@ -187,18 +189,18 @@ int main(int argc, char *argv[])
     MPI_Get_elements(&status, MPI_INT, &elements);
     MPI_Get_elements_x(&status, MPI_INT, &elements_x);
     MPI_Get_count(&status, MPI_INT, &count);
-    check(elements == 10);
-    check(elements_x == 10);
-    check(count == 10);
+    check(equals(elements, 10));
+    check(equals(elements_x, 10));
+    check(equals(count, 10));
 
     /* set_x simple */
     MPI_Status_set_elements_x(&status, MPI_INT, 10);
     MPI_Get_elements(&status, MPI_INT, &elements);
     MPI_Get_elements_x(&status, MPI_INT, &elements_x);
     MPI_Get_count(&status, MPI_INT, &count);
-    check(elements == 10);
-    check(elements_x == 10);
-    check(count == 10);
+    check(equals(elements, 10));
+    check(equals(elements_x, 10));
+    check(equals(count, 10));
 
     /* Sets elements corresponding to count=1 of the given MPI datatype, using
      * set_elements and set_elements_x.  Checks expected values are returned by
@@ -213,9 +215,9 @@ int main(int argc, char *argv[])
             MPI_Get_elements(&status, (type_), &elements);        \
             MPI_Get_elements_x(&status, (type_), &elements_x);    \
             MPI_Get_count(&status, (type_), &count);              \
-            check(elements == (elts_));                           \
-            check(elements_x == (elts_));                         \
-            check(count == 1);                                    \
+            check(equals(elements, (elts_)));                     \
+            check(equals(elements_x, (elts_)));                   \
+            check(equals(count, 1));                              \
         }                                                         \
                                                                   \
         elements = elements_x = count = 0xfeedface;               \
@@ -224,13 +226,13 @@ int main(int argc, char *argv[])
         MPI_Get_elements_x(&status, (type_), &elements_x);        \
         MPI_Get_count(&status, (type_), &count);                  \
         if ((elts_) > INT_MAX) {                                  \
-            check(elements == MPI_UNDEFINED);                     \
+            check(equals(elements, MPI_UNDEFINED));               \
         }                                                         \
         else {                                                    \
-            check(elements == (elts_));                           \
+            check(equals(elements, (elts_)));                     \
         }                                                         \
-        check(elements_x == (elts_));                             \
-        check(count == 1);                                        \
+        check(equals(elements_x, (elts_)));                       \
+        check(equals(count, 1));                                  \
     } while (0)                                                   \
 
     check_set_elements(imax_contig, INT_MAX);