Преглед изворни кода

Forgot another place requiring hwloc API 2 filters.

Terry Cojean пре 8 година
родитељ
комит
9fa541ec16
3 измењених фајлова са 15 додато и 6 уклоњено
  1. 2 1
      src/core/perfmodel/perfmodel_bus.c
  2. 10 5
      src/core/topology.c
  3. 3 0
      src/core/topology.h

+ 2 - 1
src/core/perfmodel/perfmodel_bus.c

@@ -35,6 +35,7 @@
 #include <core/workers.h>
 #include <core/perfmodel/perfmodel.h>
 #include <core/simgrid.h>
+#include <core/topology.h>
 #include <common/utils.h>
 
 #ifdef STARPU_USE_OPENCL
@@ -2311,7 +2312,7 @@ static void write_bus_platform_file_content(int version)
 	{
 		hwloc_topology_t topology;
 		hwloc_topology_init(&topology);
-		hwloc_topology_set_flags(topology, HWLOC_TOPOLOGY_FLAG_IO_DEVICES | HWLOC_TOPOLOGY_FLAG_IO_BRIDGES);
+		_starpu_topology_filter(topology);
 		hwloc_topology_load(topology);
 
 		/* First find paths and record measured bandwidth along the path */

+ 10 - 5
src/core/topology.c

@@ -527,11 +527,7 @@ _starpu_init_topology (struct _starpu_machine_config *config)
 #ifndef STARPU_SIMGRID
 #ifdef STARPU_HAVE_HWLOC
 	hwloc_topology_init(&topology->hwtopology);
-#if HWLOC_API_VERSION >= 0x20000
-	hwloc_topology_set_io_types_filter(topology->hwtopology, HWLOC_TYPE_FILTER_KEEP_IMPORTANT);
-#else
-	hwloc_topology_set_flags(topology->hwtopology, HWLOC_TOPOLOGY_FLAG_IO_DEVICES | HWLOC_TOPOLOGY_FLAG_IO_BRIDGES);
-#endif
+	_starpu_topology_filter(topology->hwtopology);
 	hwloc_topology_load(topology->hwtopology);
 	_starpu_allocate_topology_userdata(hwloc_get_root_obj(topology->hwtopology));
 #endif
@@ -804,6 +800,15 @@ _starpu_topology_get_nhwpu (struct _starpu_machine_config *config)
 	return config->topology.nhwpus;
 }
 
+void _starpu_topology_filter(hwloc_topology_t topology)
+{
+#if HWLOC_API_VERSION >= 0x20000
+	hwloc_topology_set_io_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_IMPORTANT);
+#else
+	hwloc_topology_set_flags(topology, HWLOC_TOPOLOGY_FLAG_IO_DEVICES | HWLOC_TOPOLOGY_FLAG_IO_BRIDGES);
+#endif
+}
+
 #ifdef STARPU_USE_MIC
 static void
 _starpu_init_mic_config (struct _starpu_machine_config *config,

+ 3 - 0
src/core/topology.h

@@ -51,6 +51,9 @@ unsigned _starpu_topology_get_nhwcpu(struct _starpu_machine_config *config);
 /* returns the number of logical cpus */
 unsigned _starpu_topology_get_nhwpu(struct _starpu_machine_config *config);
 
+/* Small convenient function to filter hwloc topology depending on HWLOC API version */
+void _starpu_topology_filter(hwloc_topology_t topology);
+
 #define STARPU_NOWORKERID -1
 /* Bind the current thread on the CPU logically identified by "cpuid". The
  * logical ordering of the processors is either that of hwloc (if available),