Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill xbt_dynar_dopar().
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 23 Nov 2012 09:15:46 +0000 (10:15 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 23 Nov 2012 09:16:42 +0000 (10:16 +0100)
Keep it as a separated commit, to make a potential revert easier.

15 files changed:
ChangeLog
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/UnitTesting.cmake
examples/platforms/content/storage_content.txt
include/xbt/synchro.h [deleted file]
include/xbt/synchro_core.h
src/xbt/ex.c
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c
src/xbt/xbt_queue.c
src/xbt/xbt_rl_synchro.c
src/xbt/xbt_sg_synchro.c
src/xbt/xbt_synchro.c [deleted file]
teshsuite/xbt/log_large_test.c
teshsuite/xbt/parallel_log_crashtest.c

index 3eebff9..368047a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,8 +8,9 @@ SimGrid (3.9) NOT RELEASED; urgency=low
  * New function: MSG_process_get_number()
 
  XBT:
  * New function: MSG_process_get_number()
 
  XBT:
- * kill synchronized dynars. We cannot think of a usecase where it's
-   really mandatory, and maintaining it was a pain in our codebase.
+ * Kill synchronized dynars, and xbt_dynar_dopar(). We cannot think of a
+   usecase where it's really mandatory, and maintaining it was a pain in
+   our codebase.
 
  -- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
 
  -- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
index 726379c..a2e0d47 100644 (file)
@@ -154,7 +154,6 @@ set(XBT_SRC
   src/xbt/xbt_sha.c
   src/xbt/xbt_str.c
   src/xbt/xbt_strbuff.c
   src/xbt/xbt_sha.c
   src/xbt/xbt_str.c
   src/xbt/xbt_strbuff.c
-  src/xbt/xbt_synchro.c
   src/xbt/xbt_virtu.c
   src/xbt_modinter.h
   )
   src/xbt/xbt_virtu.c
   src/xbt_modinter.h
   )
@@ -402,7 +401,6 @@ set(headers_to_install
   include/xbt/str.h
   include/xbt/strbuff.h
   include/xbt/swag.h
   include/xbt/str.h
   include/xbt/strbuff.h
   include/xbt/swag.h
-  include/xbt/synchro.h
   include/xbt/synchro_core.h
   include/xbt/sysdep.h
   include/xbt/virtu.h
   include/xbt/synchro_core.h
   include/xbt/sysdep.h
   include/xbt/virtu.h
index 62fb68a..4351f1b 100644 (file)
@@ -12,7 +12,6 @@ set(TEST_CFILES
   src/xbt/xbt_strbuff.c
   src/xbt/xbt_sha.c
   src/xbt/config.c
   src/xbt/xbt_strbuff.c
   src/xbt/xbt_sha.c
   src/xbt/config.c
-  src/xbt/xbt_synchro.c
   src/xbt/parmap.c
   )
 set(TEST_UNITS
   src/xbt/parmap.c
   )
 set(TEST_UNITS
@@ -26,7 +25,6 @@ set(TEST_UNITS
   ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_strbuff_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_sha_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/config_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_strbuff_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_sha_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/config_unit.c
-  ${CMAKE_CURRENT_BINARY_DIR}/src/xbt_synchro_unit.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/parmap_unit.c
 
   ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_units_main.c
   ${CMAKE_CURRENT_BINARY_DIR}/src/parmap_unit.c
 
   ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_units_main.c
index 4a13ec4..c63534f 100644 (file)
 -rw-r--r-- 1 user user 648 2011-10-05 16:04 ./include/xbt/module.h
 -rw-r--r-- 1 user user 5523 2011-10-05 16:04 ./include/xbt/cunit.h
 -rw-r--r-- 1 user user 1166 2011-10-05 16:04 ./include/xbt/parmap.h
 -rw-r--r-- 1 user user 648 2011-10-05 16:04 ./include/xbt/module.h
 -rw-r--r-- 1 user user 5523 2011-10-05 16:04 ./include/xbt/cunit.h
 -rw-r--r-- 1 user user 1166 2011-10-05 16:04 ./include/xbt/parmap.h
--rw-r--r-- 1 user user 845 2011-10-05 16:04 ./include/xbt/synchro.h
 -rw-r--r-- 1 user user 2296 2011-10-05 16:04 ./include/xbt/mallocator.h
 -rw-r--r-- 1 user user 9553 2011-10-05 16:04 ./include/xbt/dynar.h
 -rw-r--r-- 1 user user 1444 2011-10-05 16:04 ./include/xbt/heap.h
 -rw-r--r-- 1 user user 2296 2011-10-05 16:04 ./include/xbt/mallocator.h
 -rw-r--r-- 1 user user 9553 2011-10-05 16:04 ./include/xbt/dynar.h
 -rw-r--r-- 1 user user 1444 2011-10-05 16:04 ./include/xbt/heap.h
diff --git a/include/xbt/synchro.h b/include/xbt/synchro.h
deleted file mode 100644 (file)
index e735325..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* xbt/synchro.h -- Synchronization tools                                   */
-/* Usable in simulator, (or in real life when mixing with GRAS)             */
-
-/* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/* synchro_core.h is splited away since it is used by dynar.h, and we use dynar here */
-
-#ifndef SYNCHRO_H_
-#define SYNCHRO_H_
-#include "xbt/misc.h"           /* SG_BEGIN_DECL */
-#include "xbt/dynar.h"
-SG_BEGIN_DECL()
-
-XBT_PUBLIC(void) xbt_dynar_dopar(xbt_dynar_t datas,
-                                 void_f_int_pvoid_t function);
-
-SG_END_DECL()
-#endif                          /* SYNCHRO_H_ */
index 51fee8e..afa9207 100644 (file)
@@ -1,4 +1,4 @@
-/* xbt/synchro.h -- Synchronization tools                                   */
+/* xbt/synchro_core.h -- Synchronization tools                              */
 /* Usable in simulator, (or in real life when mixing with GRAS)             */
 
 /* Copyright (c) 2009, 2010. The SimGrid Team.
 /* Usable in simulator, (or in real life when mixing with GRAS)             */
 
 /* Copyright (c) 2009, 2010. The SimGrid Team.
index f4ab2b7..d853cf5 100644 (file)
@@ -48,7 +48,6 @@
 #include "xbt/str.h"
 #include "xbt/module.h"         /* xbt_binary_name */
 #include "xbt_modinter.h"       /* backtrace initialization headers */
 #include "xbt/str.h"
 #include "xbt/module.h"         /* xbt_binary_name */
 #include "xbt_modinter.h"       /* backtrace initialization headers */
-#include "xbt/synchro.h"        /* xbt_thread_self */
 
 #include "xbt/ex_interface.h"
 
 
 #include "xbt/ex_interface.h"
 
index 5d03f6f..651a2ff 100644 (file)
@@ -11,7 +11,6 @@
 #include "xbt/sysdep.h"
 #include "xbt/strbuff.h"
 #include "xbt/log_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/strbuff.h"
 #include "xbt/log_private.h"
-#include "xbt/synchro.h"        /* xbt_thread_self_name */
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
 #include <stdio.h>
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
 #include <stdio.h>
index 84571d6..be6b390 100644 (file)
@@ -9,7 +9,6 @@
 #include "xbt/sysdep.h"
 #include "xbt/strbuff.h"        /* For dynamic version when the static one fails */
 #include "xbt/log_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/strbuff.h"        /* For dynamic version when the static one fails */
 #include "xbt/log_private.h"
-#include "xbt/synchro.h"        /* xbt_thread_name */
 
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
 
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
index 4585ae1..6dc3c95 100644 (file)
@@ -12,7 +12,6 @@
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 
-#include "xbt/synchro.h"
 #include "xbt/queue.h"          /* this module */
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue, xbt,
                                 "Message exchanging queue");
 #include "xbt/queue.h"          /* this module */
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue, xbt,
                                 "Message exchanging queue");
index a0a855b..c33b03e 100644 (file)
@@ -14,7 +14,6 @@
 #include "xbt/ex.h"
 #include "portable.h"
 
 #include "xbt/ex.h"
 #include "portable.h"
 
-#include "xbt/synchro.h"        /* This module */
 #include "xbt/xbt_os_thread.h"  /* The implementation we use */
 
 /* the implementation would be cleaner (and faster) with ELF symbol aliasing */
 #include "xbt/xbt_os_thread.h"  /* The implementation we use */
 
 /* the implementation would be cleaner (and faster) with ELF symbol aliasing */
index 7e3bcba..f0f87ef 100644 (file)
@@ -11,8 +11,6 @@
 
 #include "xbt/ex.h"
 
 
 #include "xbt/ex.h"
 
-#include "xbt/synchro.h"        /* This module */
-
 #include "simgrid/simix.h"        /* used implementation */
 #include "../simix/smx_private.h" /* FIXME */
 
 #include "simgrid/simix.h"        /* used implementation */
 #include "../simix/smx_private.h" /* FIXME */
 
diff --git a/src/xbt/xbt_synchro.c b/src/xbt/xbt_synchro.c
deleted file mode 100644 (file)
index a2349d8..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* xbt_synchro -- advanced multithreaded features                           */
-/* Working on top of real threads in RL and of simulated processes in SG    */
-
-/* Copyright (c) 2009, 2010. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "xbt/sysdep.h"
-#include "xbt/dynar.h"
-#include "xbt/synchro.h"
-#include "xbt/xbt_os_thread.h"
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_sync);
-
-typedef struct {
-  xbt_dynar_t data;
-  int rank;
-  void_f_int_pvoid_t function;
-  xbt_os_thread_t worker;
-} s_worker_data_t, *worker_data_t;
-
-static void worker_wait_n_free(void *w)
-{
-  worker_data_t worker = *(worker_data_t *) w;
-  xbt_os_thread_join(worker->worker, NULL);
-  xbt_free(worker);
-}
-
-static void *worker_wrapper(void *w)
-{
-  worker_data_t me = (worker_data_t) w;
-  me->function(me->rank, xbt_dynar_get_ptr(me->data, me->rank));
-  return NULL;
-}
-
-void xbt_dynar_dopar(xbt_dynar_t datas, void_f_int_pvoid_t function)
-{
-  xbt_dynar_t workers =
-      xbt_dynar_new(sizeof(worker_data_t), worker_wait_n_free);
-  unsigned int cursor;
-  void *data;
-  if (xbt_dynar_is_empty(datas))
-    return;                     /* nothing to do */
-  if (xbt_dynar_length(datas) == 1) {
-    /* don't start any new thread, do it directly */
-    function(0, xbt_dynar_get_ptr(datas, 0));
-    return;
-  }
-  /* Start all workers */
-  XBT_DEBUG("Dopar for %lu elements", xbt_dynar_length(datas));
-  xbt_dynar_foreach(datas, cursor, data) {
-    worker_data_t w = xbt_new0(s_worker_data_t, 1);
-    w->data = datas;
-    w->function = function;
-    w->rank = cursor;
-    xbt_dynar_push(workers, &w);
-    w->worker =
-        xbt_os_thread_create("dopar worker", worker_wrapper, w, NULL);
-  }
-  /* wait them all */
-  xbt_dynar_free(&workers);
-}
-
-#ifdef SIMGRID_TEST
-#define NB_ELEM 50
-#include "xbt/synchro.h"
-
-XBT_TEST_SUITE("synchro", "Advanced synchronization mecanisms");
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_dyn);
-
-static void add100(int rank, void *data)
-{
-  //XBT_INFO("Thread%d: Add 100 to %d",rank,*(int*)data);
-  *(int *) data += 100;
-}
-
-XBT_TEST_UNIT("dopar", test_dynar_dopar, "do parallel on dynars of integers")
-{
-  xbt_dynar_t d;
-  int i, cpt;
-  unsigned int cursor;
-
-  xbt_test_add
-      ("==== Push %d int, add 100 to each of them in parallel and check the results",
-       NB_ELEM);
-  d = xbt_dynar_new(sizeof(int), NULL);
-  for (cpt = 0; cpt < NB_ELEM; cpt++) {
-    xbt_dynar_push_as(d, int, cpt);     /* This is faster (and possible only with scalars) */
-    xbt_test_log("Push %d, length=%lu", cpt, xbt_dynar_length(d));
-  }
-  xbt_dynar_dopar(d, add100);
-  cpt = 100;
-  xbt_dynar_foreach(d, cursor, i) {
-    xbt_test_assert(i == cpt,
-                     "The retrieved value is not the expected one (%d!=%d)",
-                     i, cpt);
-    cpt++;
-  }
-  xbt_dynar_free(&d);
-}
-
-#endif                          /* SIMGRID_TEST */
index b27529c..20c4bbc 100644 (file)
@@ -7,7 +7,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
-#include "xbt/synchro.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
 
index 7fd9780..f181bdf 100644 (file)
@@ -7,7 +7,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt.h"
-#include "xbt/synchro.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");