瀏覽代碼

merge trunk@7001:7005

Nathalie Furmento 13 年之前
父節點
當前提交
15fbd0e69f
共有 5 個文件被更改,包括 52 次插入0 次删除
  1. 5 0
      doc/chapters/advanced-examples.texi
  2. 4 0
      doc/chapters/basic-api.texi
  3. 3 0
      include/starpu.h
  4. 37 0
      src/core/topology.c
  5. 3 0
      tools/starpu_machine_display.c

+ 5 - 0
doc/chapters/advanced-examples.texi

@@ -899,6 +899,11 @@ For example : if the user specifies a minimum and maximum combined workers size
 of 3 on a machine containing 8 CPUs, StarPU will create a combined worker of
 size 2 beside the combined workers of size 3.
 
+The combined workers actually produced can be seen in the output of the
+@code{starpu_machine_display} tool (the @code{STARPU_SCHED} environment variable
+has to be set to a combined worker-aware scheduler such as @code{pheft} or
+@code{pgreedy}).
+
 @subsection Concurrent parallel tasks
 
 Unfortunately, many environments and librairies do not support concurrent

+ 4 - 0
doc/chapters/basic-api.texi

@@ -1986,6 +1986,10 @@ prints a matrix of bus bandwidths on @var{f}.
 prints the affinity devices on @var{f}.
 @end deftypefun
 
+@deftypefun void starpu_topology_print ({FILE *}@var{f})
+prints a description of the topology on @var{f}.
+@end deftypefun
+
 @deftypefun void starpu_perfmodel_update_history ({struct starpu_perfmodel *}@var{model}, {struct starpu_task *}@var{task}, {enum starpu_perf_archtype} @var{arch}, unsigned @var{cpuid}, unsigned @var{nimpl}, double @var{measured});
 This feeds the performance model @var{model} with an explicit measurement
 @var{measured}, in addition to measurements done by StarPU itself. This can be

+ 3 - 0
include/starpu.h

@@ -146,6 +146,9 @@ int starpu_init(struct starpu_conf *conf);// STARPU_WARN_UNUSED_RESULT;
  * shutdown */
 void starpu_shutdown(void);
 
+/* Print topology configuration */
+void starpu_topology_print(FILE *output);
+
 /* This function returns the number of workers (ie. processing units executing
  * StarPU tasks). The returned value should be at most STARPU_NMAXWORKERS. */
 unsigned starpu_worker_get_count(void);

+ 37 - 0
src/core/topology.c

@@ -904,3 +904,40 @@ void _starpu_destroy_topology(struct _starpu_machine_config *config __attribute_
 #endif
 }
 
+void starpu_topology_print(FILE *output)
+{
+	struct _starpu_machine_config *config = _starpu_get_machine_config();
+	struct starpu_machine_topology *topology = &config->topology;
+	unsigned core;
+	unsigned worker;
+	unsigned nworkers = starpu_worker_get_count();
+	unsigned ncombinedworkers = topology->ncombinedworkers;
+
+	for (core = 0; core < topology->nhwcpus; core++) {
+		fprintf(output, "core %d\t", core);
+		for (worker = 0; worker < nworkers + ncombinedworkers; worker++)
+		{
+			if (worker < nworkers)
+			{
+				if (topology->workers_bindid[worker] == core)
+				{
+					char name[256];
+					starpu_worker_get_name(worker, name, sizeof(name));
+					fprintf(output, "%s\t", name);
+				}
+			}
+			else
+			{
+				int worker_size, i;
+				int *combined_workerid;
+				starpu_combined_worker_get_description(worker, &worker_size, &combined_workerid);
+				for (i = 0; i < worker_size; i++)
+				{
+					if (topology->workers_bindid[combined_workerid[i]] == core)
+						fprintf(output, "comb %d\t", worker-nworkers);
+				}
+			}
+		}
+		fprintf(output, "\n");
+	}
+}

+ 3 - 0
tools/starpu_machine_display.c

@@ -148,6 +148,9 @@ int main(int argc, char **argv)
 
 	display_all_combined_workers();
 
+	fprintf(stdout, "\ntopology ...\n");
+	starpu_topology_print(stdout);
+
 	fprintf(stdout, "\nbandwidth ...\n");
 	starpu_bus_print_bandwidth(stdout);