X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b8085ad1e53fffb4415cfc8dfb6a57b93497223..fbf3527063143094ed40d1a4a3bc595c29b81145:/src/xbt/parmap.cpp diff --git a/src/xbt/parmap.cpp b/src/xbt/parmap.cpp index b30d67d01b..88431cc0d2 100644 --- a/src/xbt/parmap.cpp +++ b/src/xbt/parmap.cpp @@ -6,7 +6,7 @@ #include -#include "internal_config.h" +#include "src/internal_config.h" #ifdef HAVE_UNISTD_H #include #endif @@ -26,7 +26,8 @@ #include "xbt/dynar.h" #include "xbt/xbt_os_thread.h" #include "xbt/sysdep.h" -#include "simix/smx_private.h" +#include "src/simix/smx_private.h" +#include "src/simix/smx_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_parmap, xbt, "parmap: parallel map"); @@ -119,8 +120,6 @@ typedef s_xbt_parmap_thread_data_t *xbt_parmap_thread_data_t; */ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) { - unsigned int i; - XBT_DEBUG("Create new parmap (%u workers)", num_workers); /* Initialize the thread pool data structure */ @@ -134,22 +133,20 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode) /* Create the pool of worker threads */ xbt_parmap_thread_data_t data; parmap->workers[0] = NULL; -#ifdef CORE_BINDING - unsigned int core_bind = 0; +#ifdef HAVE_PTHREAD_SETAFFINITY + int core_bind = 0; #endif - for (i = 1; i < num_workers; i++) { + for (unsigned int i = 1; i < num_workers; i++) { data = xbt_new0(s_xbt_parmap_thread_data_t, 1); data->parmap = parmap; data->worker_id = i; - parmap->workers[i] = xbt_os_thread_create(NULL, xbt_parmap_worker_main, - data, NULL); -#ifdef CORE_BINDING + parmap->workers[i] = xbt_os_thread_create(NULL, xbt_parmap_worker_main, data, NULL); +#ifdef HAVE_PTHREAD_SETAFFINITY xbt_os_thread_bind(parmap->workers[i], core_bind); - if(core_bind!=xbt_os_get_numcores()){ + if (core_bind != xbt_os_get_numcores()) core_bind++; - } else { + else core_bind = 0; - } #endif } return parmap;