Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[XBT] Fix wrong indices.
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 27 Jun 2016 17:29:03 +0000 (19:29 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Tue, 28 Jun 2016 10:31:46 +0000 (12:31 +0200)
Cores should start from 0 until max-1. Here, it
was mistakenly 0 until max

src/xbt/parmap.cpp

index ac96752..62a691d 100644 (file)
@@ -126,8 +126,8 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
     data->worker_id = i;
     parmap->workers[i] = xbt_os_thread_create(nullptr, xbt_parmap_worker_main, data, nullptr);
 #if HAVE_PTHREAD_SETAFFINITY
     data->worker_id = i;
     parmap->workers[i] = xbt_os_thread_create(nullptr, xbt_parmap_worker_main, data, nullptr);
 #if HAVE_PTHREAD_SETAFFINITY
-    xbt_os_thread_bind(parmap->workers[i], core_bind); 
-    if (core_bind != xbt_os_get_numcores())
+    xbt_os_thread_bind(parmap->workers[i], core_bind);
+    if (core_bind != xbt_os_get_numcores() - 1)
       core_bind++;
     else
       core_bind = 0; 
       core_bind++;
     else
       core_bind = 0;