Browse Source

Show package/numa topology in starpu_machine_display

Samuel Thibault 8 years ago
parent
commit
13f8e465d8
1 changed files with 24 additions and 0 deletions
  1. 24 0
      src/core/topology.c

+ 24 - 0
src/core/topology.c

@@ -2231,8 +2231,32 @@ starpu_topology_print (FILE *output)
 	unsigned ncombinedworkers = topology->ncombinedworkers;
 	unsigned ncombinedworkers = topology->ncombinedworkers;
 	unsigned nthreads_per_core = topology->nhwpus / topology->nhwcpus;
 	unsigned nthreads_per_core = topology->nhwpus / topology->nhwcpus;
 
 
+#ifdef STARPU_HAVE_HWLOC
+	hwloc_topology_t topo = topology->hwtopology;
+	hwloc_obj_t pu_obj;
+	hwloc_obj_t last_numa_obj = NULL, numa_obj;
+	hwloc_obj_t last_package_obj = NULL, package_obj;
+#endif
+
 	for (pu = 0; pu < topology->nhwpus; pu++)
 	for (pu = 0; pu < topology->nhwpus; pu++)
 	{
 	{
+#ifdef STARPU_HAVE_HWLOC
+		pu_obj = hwloc_get_obj_by_type(topo, HWLOC_OBJ_PU, pu);
+		numa_obj = hwloc_get_ancestor_obj_by_type(topo, HWLOC_OBJ_NUMANODE, pu_obj);
+		if (numa_obj != last_numa_obj)
+		{
+			fprintf(output, "numa %u", numa_obj->logical_index);
+			last_numa_obj = numa_obj;
+		}
+		fprintf(output, "\t");
+		package_obj = hwloc_get_ancestor_obj_by_type(topo, HWLOC_OBJ_PACKAGE, pu_obj);
+		if (package_obj != last_package_obj)
+		{
+			fprintf(output, "pack %u", package_obj->logical_index);
+			last_package_obj = package_obj;
+		}
+		fprintf(output, "\t");
+#endif
 		if ((pu % nthreads_per_core) == 0)
 		if ((pu % nthreads_per_core) == 0)
 			fprintf(output, "core %u", pu / nthreads_per_core);
 			fprintf(output, "core %u", pu / nthreads_per_core);
 		fprintf(output, "\tPU %u\t", pu);
 		fprintf(output, "\tPU %u\t", pu);