Browse Source

port to hwloc 1.1 interface

Samuel Thibault 14 years ago
parent
commit
468a2a037b
2 changed files with 20 additions and 7 deletions
  1. 8 2
      src/core/combined_workers.c
  2. 12 5
      src/core/topology.c

+ 8 - 2
src/core/combined_workers.c

@@ -24,6 +24,12 @@
 #include <windows.h>
 #endif
 
+#ifndef HWLOC_BITMAP_H
+/* hwloc <1.1 does not offer the bitmap API yet */
+#define hwloc_bitmap_alloc hwloc_cpuset_alloc
+#define hwloc_bitmap_or hwloc_cpuset_or
+#endif
+
 /* Create a new worker id for a combination of workers. This method should
  * typically be called at the initialization of the scheduling policy. This
  * worker should be the combination of the list of id's contained in the
@@ -90,7 +96,7 @@ int starpu_combined_worker_assign_workerid(int nworkers, int workerid_array[])
 	CPU_ZERO(&combined_worker->cpu_set);
 #endif /* STARPU_HAVE_WINDOWS */
 #ifdef STARPU_HAVE_HWLOC
-	combined_worker->hwloc_cpu_set = hwloc_cpuset_alloc();
+	combined_worker->hwloc_cpu_set = hwloc_bitmap_alloc();
 #endif
 
 	for (i = 0; i < nworkers; i++)
@@ -103,7 +109,7 @@ int starpu_combined_worker_assign_workerid(int nworkers, int workerid_array[])
 #endif /* STARPU_HAVE_WINDOWS */
 
 #ifdef STARPU_HAVE_HWLOC
-		hwloc_cpuset_or(combined_worker->hwloc_cpu_set,
+		hwloc_bitmap_or(combined_worker->hwloc_cpu_set,
 				combined_worker->hwloc_cpu_set,
 				config->workers[id].initial_hwloc_cpu_set);
 #endif

+ 12 - 5
src/core/topology.c

@@ -34,6 +34,13 @@
 #ifdef STARPU_HAVE_WINDOWS
 #include <windows.h>
 #endif
+#ifndef HWLOC_BITMAP_H
+/* hwloc <1.1 does not offer the bitmap API yet */
+#define hwloc_bitmap_alloc hwloc_cpuset_alloc
+#define hwloc_bitmap_only hwloc_cpuset_cpu
+#define hwloc_bitmap_singlify hwloc_cpuset_singlify
+#endif
+
 		
 static unsigned topology_is_initialized = 0;
 
@@ -580,7 +587,7 @@ void _starpu_bind_thread_on_cpu(struct starpu_machine_config_s *config __attribu
 
 	hwloc_obj_t obj = hwloc_get_obj_by_depth(config->topology.hwtopology, config->cpu_depth, cpuid);
 	hwloc_cpuset_t set = obj->cpuset;
-	hwloc_cpuset_singlify(set);
+	hwloc_bitmap_singlify(set);
 	ret = hwloc_set_cpubind(config->topology.hwtopology, set, HWLOC_CPUBIND_THREAD);
 	if (ret)
 	{
@@ -712,10 +719,10 @@ static void _starpu_init_workers_binding(struct starpu_machine_config_s *config)
 
 #ifdef STARPU_HAVE_HWLOC
 		/* Clear the cpu set and set the cpu */
-		workerarg->initial_hwloc_cpu_set = hwloc_cpuset_alloc();
-		hwloc_cpuset_cpu(workerarg->initial_hwloc_cpu_set, workerarg->bindid);
-		workerarg->current_hwloc_cpu_set = hwloc_cpuset_alloc();
-		hwloc_cpuset_cpu(workerarg->current_hwloc_cpu_set, workerarg->bindid);
+		workerarg->initial_hwloc_cpu_set = hwloc_bitmap_alloc();
+		hwloc_bitmap_only(workerarg->initial_hwloc_cpu_set, workerarg->bindid);
+		workerarg->current_hwloc_cpu_set = hwloc_bitmap_alloc();
+		hwloc_bitmap_only(workerarg->current_hwloc_cpu_set, workerarg->bindid);
 #endif
 	}
 }