Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove legacy parmap functions.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 3 Aug 2017 11:56:50 +0000 (13:56 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 3 Aug 2017 11:56:50 +0000 (13:56 +0200)
include/xbt/parmap.h
src/xbt/parmap.cpp

index 2b75fcd..d12a2f2 100644 (file)
@@ -9,12 +9,6 @@
 #ifndef XBT_PARMAP_H
 #define XBT_PARMAP_H
 
 #ifndef XBT_PARMAP_H
 #define XBT_PARMAP_H
 
-#include "xbt/misc.h"           /* SG_BEGIN_DECL */
-#include "xbt/function_types.h"
-#include "xbt/dynar.h"
-
-SG_BEGIN_DECL()
-
 /** \addtogroup XBT_parmap
   * \ingroup XBT_misc
   * \brief Parallel map.
 /** \addtogroup XBT_parmap
   * \ingroup XBT_misc
   * \brief Parallel map.
@@ -28,9 +22,6 @@ SG_BEGIN_DECL()
   * \{
   */
 
   * \{
   */
 
-/** \brief Parallel map data type (opaque type) */
-typedef struct s_xbt_parmap *xbt_parmap_t;
-
 /** \brief Synchronization mode of the worker threads of a parmap. */
 typedef enum {
   XBT_PARMAP_POSIX,          /**< use POSIX synchronization primitives */
 /** \brief Synchronization mode of the worker threads of a parmap. */
 typedef enum {
   XBT_PARMAP_POSIX,          /**< use POSIX synchronization primitives */
@@ -39,13 +30,6 @@ typedef enum {
   XBT_PARMAP_DEFAULT         /**< futex if available, posix otherwise */
 } e_xbt_parmap_mode_t;
 
   XBT_PARMAP_DEFAULT         /**< futex if available, posix otherwise */
 } e_xbt_parmap_mode_t;
 
-XBT_PUBLIC(xbt_parmap_t) xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode);
-XBT_PUBLIC(void) xbt_parmap_destroy(xbt_parmap_t parmap);
-XBT_PUBLIC(void) xbt_parmap_apply(xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data);
-XBT_PUBLIC(void*) xbt_parmap_next(xbt_parmap_t parmap);
-
 /** \} */
 
 /** \} */
 
-SG_END_DECL()
-
 #endif
 #endif
index 85145b5..c5754e4 100644 (file)
@@ -3,66 +3,6 @@
 /* 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. */
 
 /* 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/parmap.h"
 #include "xbt/log.h"
 #include "xbt/log.h"
-#include "xbt/parmap.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_parmap, xbt, "parmap: parallel map");
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_parmap, xbt, "parmap: parallel map");
-
-/**
- * \brief Parallel map structure
- */
-typedef struct s_xbt_parmap {
-  simgrid::xbt::Parmap<void*> p;
-} s_xbt_parmap_t;
-
-/**
- * \brief Creates a parallel map object
- * \param num_workers number of worker threads to create
- * \param mode how to synchronize the worker threads
- * \return the parmap created
- */
-xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
-{
-  return reinterpret_cast<xbt_parmap_t>(new simgrid::xbt::Parmap<void*>(num_workers, mode));
-}
-
-/**
- * \brief Destroys a parmap
- * \param parmap the parmap to destroy
- */
-void xbt_parmap_destroy(xbt_parmap_t parmap)
-{
-  delete parmap;
-}
-
-/**
- * \brief Applies a list of tasks in parallel.
- * \param parmap a parallel map object
- * \param fun the function to call in parallel
- * \param data each element of this dynar will be passed as an argument to fun
- */
-void xbt_parmap_apply(xbt_parmap_t parmap, void_f_pvoid_t fun, xbt_dynar_t data)
-{
-  if (!xbt_dynar_is_empty(data)) {
-    void** pdata = (void**)xbt_dynar_get_ptr(data, 0);
-    std::vector<void*> vdata(pdata, pdata + xbt_dynar_length(data));
-    parmap->p.apply(fun, vdata);
-  }
-}
-
-/**
- * \brief Returns a next task to process.
- *
- * Worker threads call this function to get more work.
- *
- * \return the next task to process, or nullptr if there is no more work
- */
-void* xbt_parmap_next(xbt_parmap_t parmap)
-{
-  try {
-    return parmap->p.next();
-  } catch (std::out_of_range) {
-    return nullptr;
-  }
-}