Bladeren bron

Implement again STARPU_MIN_WORKERSIZE and STARPU_MAX_WORKERSIZE environment variables

Samuel Thibault 12 jaren geleden
bovenliggende
commit
6758f640ec
2 gewijzigde bestanden met toevoegingen van 26 en 4 verwijderingen
  1. 14 2
      doc/chapters/configuration.texi
  2. 12 2
      src/sched_policies/detect_combined_workers.c

+ 14 - 2
doc/chapters/configuration.texi

@@ -417,8 +417,20 @@ the @code{starpu_conf} structure passed to @code{starpu_init} is set.
 
 @defvr {Environment variable} @code{STARPU_SINGLE_COMBINED_WORKER}
 If set, StarPU will create several workers which won't be able to work
-concurrently. It will create combined workers which size goes from 1 to the
-total number of CPU workers in the system.
+concurrently. It will by default create combined workers which size goes from 1
+to the total number of CPU workers in the system. @code{STARPU_MIN_WORKERSIZE}
+and @code{STARPU_MAX_WORKERSIZE} can be used to change this default.
+@end defvr
+
+@defvr {Environment variable} @code{STARPU_MIN_WORKERSIZE}
+When @code{STARPU_SINGLE_COMBINED_WORKER} is set, @code{STARPU_MIN_WORKERSIZE}
+permits to specify the minimum size of the combined workers (instead of the default 1)
+@end defvr
+
+@defvr {Environment variable} @code{STARPU_MAX_WORKERSIZE}
+When @code{STARPU_SINGLE_COMBINED_WORKER} is set, @code{STARPU_MAX_WORKERSIZE}
+permits to specify the minimum size of the combined workers (instead of the
+number of CPU workers in the system)
 @end defvr
 
 @defvr {Environment variable} STARPU_SYNTHESIZE_ARITY_COMBINED_WORKER

+ 12 - 2
src/sched_policies/detect_combined_workers.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  * Copyright (C) 2011, 2012       Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -233,6 +233,9 @@ static void combine_all_cpu_workers(int *workerids, int nworkers)
 	int ncpus = 0;
 	struct _starpu_worker *worker;
 	int i;
+	int min;
+	int max;
+
 	for (i = 0; i < nworkers; i++)
 	{
 		worker = _starpu_get_worker_struct(workerids[i]);
@@ -241,7 +244,14 @@ static void combine_all_cpu_workers(int *workerids, int nworkers)
 			cpu_workers[ncpus++] = workerids[i];
 	}
 
-	for (i = 1; i <= ncpus; i++)
+	min = starpu_get_env_number("STARPU_MIN_WORKERSIZE");
+	if (min < 1)
+		min = 1;
+	max = starpu_get_env_number("STARPU_MAX_WORKERSIZE");
+	if (max == -1 || max > ncpus)
+		max = ncpus;
+
+	for (i = min; i <= max; i++)
 	{
 		int newworkerid;
 		newworkerid = starpu_combined_worker_assign_workerid(i, cpu_workers);