Parcourir la source

sched_policy: rename parallel greedy scheduler to parallel eager

Nathalie Furmento il y a 12 ans
Parent
commit
2fe2fd8755

+ 1 - 1
.gitignore

@@ -144,7 +144,7 @@ starpu.log
 /tests/parallel_tasks/explicit_combined_worker
 /tests/parallel_tasks/parallel_kernels
 /tests/parallel_tasks/parallel_kernels_spmd
-/tests/parallel_tasks/spmd_pgreedy
+/tests/parallel_tasks/spmd_peager
 /tests/perfmodels/non_linear_regression_based
 /tests/perfmodels/regression_based
 /tools/cbc2paje

+ 2 - 2
doc/chapters/advanced-examples.texi

@@ -917,7 +917,7 @@ buffer.
 
 To benefit from parallel tasks, a parallel-task-aware StarPU scheduler has to
 be used. When exposed to codelets with a Fork or SPMD flag, the @code{pheft}
-(parallel-heft) and @code{pgreedy} (parallel greedy) schedulers will indeed also
+(parallel-heft) and @code{peager} (parallel eager) schedulers will indeed also
 try to execute tasks with several CPUs. It will automatically try the various
 available combined worker sizes and thus be able to avoid choosing a large
 combined worker if the codelet does not actually scale so much.
@@ -935,7 +935,7 @@ permits to tune the maximum arity between levels of combined workers.
 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}).
+@code{peager}).
 
 @subsection Concurrent parallel tasks
 

+ 1 - 1
doc/chapters/perf-optimization.texi

@@ -197,7 +197,7 @@ is now just an alias for @b{dmda}.
 The @b{pheft} (parallel HEFT) scheduler is similar to heft, it also supports
 parallel tasks (still experimental).
 
-The @b{pgreedy} (parallel greedy) scheduler is similar to greedy, it also
+The @b{peager} (parallel eager) scheduler is similar to eager, it also
 supports parallel tasks (still experimental).
 
 @node Task scheduling contexts

+ 15 - 15
examples/mandelbrot/mandelbrot.c

@@ -65,23 +65,23 @@ static void init_x11(int width, int height, unsigned *buffer)
 {
 	/* Attempt to open the display */
 	dpy = XOpenDisplay(NULL);
-	
+
 	/* Failure */
 	if (!dpy)
 		exit(0);
-	
+
 	unsigned long white = WhitePixel(dpy,DefaultScreen(dpy));
 	unsigned long black = BlackPixel(dpy,DefaultScreen(dpy));
 
 	win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
 					width, height, 0, black, white);
-	
+
 	/* We want to be notified when the window appears */
 	XSelectInput(dpy, win, StructureNotifyMask);
-	
+
 	/* Make it appear */
 	XMapWindow(dpy, win);
-	
+
 	XTextProperty tp;
 	char name[128] = "Mandelbrot - StarPU";
 	char *n = name;
@@ -91,7 +91,7 @@ static void init_x11(int width, int height, unsigned *buffer)
 
 	/* Wait for the MapNotify event */
 	XFlush(dpy);
-	
+
 	int depth = DefaultDepth(dpy, DefaultScreen(dpy));
 	Visual *visual = DefaultVisual(dpy, DefaultScreen(dpy));
 
@@ -99,13 +99,13 @@ static void init_x11(int width, int height, unsigned *buffer)
 	bitmap = XCreateImage(dpy, visual, depth,
 		ZPixmap, 0, (char *)buffer,
 		width, height, 32, 0);
-	
+
 	/* Init GC */
 	gc = XCreateGC(dpy, win, 0, NULL);
 	XSetForeground(dpy, gc, black);
-	
+
 	XSelectInput(dpy, win, ExposureMask | KeyPressMask | StructureNotifyMask);
-	
+
 	Atom wmDeleteMessage;
 	wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
 	XSetWMProtocols(dpy, win, &wmDeleteMessage, 1);
@@ -311,7 +311,7 @@ static void compute_block(void *descr[], void *cl_arg)
 				x = x2 - y2 + cx;
 				y = twoxy + cy;
 			}
-	
+
 			unsigned int v = STARPU_MIN((1024*((float)(it)/(2000))), 256);
 			data[ix + local_iy*width] = (v<<16|(255-v)<<8);
 		}
@@ -338,7 +338,7 @@ static void compute_block_spmd(void *descr[], void *cl_arg)
 			break;
 
 		iy = iby*block_size + local_iy;
-	
+
 		for (ix = 0; ix < width; ix++)
 		{
 			double cx = leftX + ix * stepX;
@@ -362,7 +362,7 @@ static void compute_block_spmd(void *descr[], void *cl_arg)
 				x = x2 - y2 + cx;
 				y = twoxy + cy;
 			}
-	
+
 			unsigned int v = STARPU_MIN((1024*((float)(it)/(2000))), 256);
 			data[ix + local_iy*width] = (v<<16|(255-v)<<8);
 		}
@@ -477,7 +477,7 @@ int main(int argc, char **argv)
 	conf.ncuda = 0;
 
 	if (use_spmd)
-		conf.sched_policy_name = "pgreedy";
+		conf.sched_policy_name = "peager";
 
 	ret = starpu_init(&conf);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
@@ -498,7 +498,7 @@ int main(int argc, char **argv)
 #endif
 
 	starpu_data_handle_t block_handles[nblocks];
-	
+
 	int iby;
 	for (iby = 0; iby < nblocks; iby++)
 	{
@@ -592,7 +592,7 @@ int main(int argc, char **argv)
 				topY -= (zoom_factor/2)*heightY;
 				bottomY += (zoom_factor/2)*heightY;
 			}
-	
+
 		}
 #ifdef STARPU_HAVE_X11
 		else if (use_x11 && handle_events())

+ 2 - 2
examples/scheduler/schedulers.sh

@@ -29,9 +29,9 @@ SCHEDULERS=`STARPU_SCHED="help" ./basic_examples/hello_world 2>&1 | awk '/->/ {p
 
 for sched in $SCHEDULERS
 do
-    # XXX pgreedy often hangs, we have to fix it.
+    # XXX peager often hangs, we have to fix it.
     # Let's just disable it for now.
-    if [ "$sched" == "pgreedy" ] ; then
+    if [ "$sched" == "peager" ] ; then
         continue
     fi
     echo "cholesky.$sched"

+ 1 - 1
src/Makefile.am

@@ -167,7 +167,7 @@ libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = 						\
 	sched_policies/fifo_queues.c				\
 	sched_policies/detect_combined_workers.c		\
 	sched_policies/parallel_heft.c				\
-	sched_policies/parallel_greedy.c			\
+	sched_policies/parallel_eager.c				\
 	drivers/driver_common/driver_common.c			\
 	datawizard/memory_nodes.c				\
 	datawizard/write_back.c					\

+ 1 - 1
src/core/sched_policy.c

@@ -44,7 +44,7 @@ static struct starpu_sched_policy *predefined_policies[] =
 	&_starpu_sched_dmda_ready_policy,
 	&_starpu_sched_dmda_sorted_policy,
 	&_starpu_sched_parallel_heft_policy,
-	&_starpu_sched_pgreedy_policy
+	&_starpu_sched_peager_policy
 };
 
 struct starpu_sched_policy *_starpu_get_sched_policy(struct _starpu_sched_ctx *sched_ctx)

+ 2 - 2
src/core/sched_policy.h

@@ -26,7 +26,7 @@
 struct starpu_machine_config;
 struct starpu_sched_policy *_starpu_get_sched_policy( struct _starpu_sched_ctx *sched_ctx);
 
-void _starpu_init_sched_policy(struct _starpu_machine_config *config, 
+void _starpu_init_sched_policy(struct _starpu_machine_config *config,
 			       struct _starpu_sched_ctx *sched_ctx, const char *required_policy);
 
 void _starpu_deinit_sched_policy(struct _starpu_sched_ctx *sched_ctx);
@@ -57,7 +57,7 @@ extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
 extern struct starpu_sched_policy _starpu_sched_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
-extern struct starpu_sched_policy _starpu_sched_pgreedy_policy;
+extern struct starpu_sched_policy _starpu_sched_peager_policy;
 
 
 #endif // __SCHED_POLICY_H__

+ 22 - 22
src/sched_policies/parallel_greedy.c

@@ -21,7 +21,7 @@
 #include <common/barrier.h>
 #include <sched_policies/detect_combined_workers.h>
 
-struct _starpu_pgreedy_data
+struct _starpu_peager_data
 {
 	struct _starpu_fifo_taskq *fifo;
 	struct _starpu_fifo_taskq *local_fifo[STARPU_NMAXWORKERS];
@@ -45,9 +45,9 @@ static int possible_combinations_size[STARPU_NMAXWORKERS][10];
   from the workers available to the program, and not to the context !!!!!!!!!!!!!!!!!!!!!!!
  */
 
-static void pgreedy_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+static void peager_add_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
 {
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	_starpu_sched_find_worker_combinations(workerids, nworkers);
 
@@ -129,9 +129,9 @@ static void pgreedy_add_workers(unsigned sched_ctx_id, int *workerids, unsigned
 #endif
 }
 
-static void pgreedy_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
+static void peager_remove_workers(unsigned sched_ctx_id, int *workerids, unsigned nworkers)
 {
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 	int workerid;
 	unsigned i;
 	for(i = 0; i < nworkers; i++)
@@ -144,11 +144,11 @@ static void pgreedy_remove_workers(unsigned sched_ctx_id, int *workerids, unsign
 	}
 }
 
-static void initialize_pgreedy_policy(unsigned sched_ctx_id)
+static void initialize_peager_policy(unsigned sched_ctx_id)
 {
 	starpu_sched_ctx_create_worker_collection(sched_ctx_id, WORKER_LIST);
 
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)malloc(sizeof(struct _starpu_pgreedy_data));
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)malloc(sizeof(struct _starpu_peager_data));
 	/* masters pick tasks from that queue */
 	data->fifo = _starpu_create_fifo();
 
@@ -158,10 +158,10 @@ static void initialize_pgreedy_policy(unsigned sched_ctx_id)
 	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)data);
 }
 
-static void deinitialize_pgreedy_policy(unsigned sched_ctx_id)
+static void deinitialize_peager_policy(unsigned sched_ctx_id)
 {
 	/* TODO check that there is no task left in the queue */
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	/* deallocate the job queue */
 	_starpu_destroy_fifo(data->fifo);
@@ -174,7 +174,7 @@ static void deinitialize_pgreedy_policy(unsigned sched_ctx_id)
 	free(data);
 }
 
-static int push_task_pgreedy_policy(struct starpu_task *task)
+static int push_task_peager_policy(struct starpu_task *task)
 {
 	unsigned sched_ctx_id = task->sched_ctx;
 	_starpu_pthread_mutex_t *changing_ctx_mutex = starpu_get_changing_ctx_mutex(sched_ctx_id);
@@ -190,16 +190,16 @@ static int push_task_pgreedy_policy(struct starpu_task *task)
    		_STARPU_PTHREAD_MUTEX_UNLOCK(changing_ctx_mutex);
 		return ret_val;
 	}
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 	ret_val = _starpu_fifo_push_task(data->fifo, &data->sched_mutex, &data->sched_cond, task);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(changing_ctx_mutex);
 
 	return ret_val;
 }
 
-static struct starpu_task *pop_task_pgreedy_policy(unsigned sched_ctx_id)
+static struct starpu_task *pop_task_peager_policy(unsigned sched_ctx_id)
 {
-	struct _starpu_pgreedy_data *data = (struct _starpu_pgreedy_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
+	struct _starpu_peager_data *data = (struct _starpu_peager_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
 
 	int workerid = starpu_worker_get_id();
 
@@ -291,17 +291,17 @@ static struct starpu_task *pop_task_pgreedy_policy(unsigned sched_ctx_id)
 	}
 }
 
-struct starpu_sched_policy _starpu_sched_pgreedy_policy =
+struct starpu_sched_policy _starpu_sched_peager_policy =
 {
-	.init_sched = initialize_pgreedy_policy,
-	.deinit_sched = deinitialize_pgreedy_policy,
-	.add_workers = pgreedy_add_workers,
-	.remove_workers = pgreedy_remove_workers,
-	.push_task = push_task_pgreedy_policy,
-	.pop_task = pop_task_pgreedy_policy,
+	.init_sched = initialize_peager_policy,
+	.deinit_sched = deinitialize_peager_policy,
+	.add_workers = peager_add_workers,
+	.remove_workers = peager_remove_workers,
+	.push_task = push_task_peager_policy,
+	.pop_task = pop_task_peager_policy,
 	.pre_exec_hook = NULL,
 	.post_exec_hook = NULL,
 	.pop_every_task = NULL,
-	.policy_name = "pgreedy",
-	.policy_description = "parallel greedy policy"
+	.policy_name = "peager",
+	.policy_description = "parallel eager policy"
 };

+ 1 - 1
tests/parallel_tasks/spmd_pgreedy.c

@@ -63,7 +63,7 @@ int main(int argc, char **argv)
 
         struct starpu_conf conf;
 	starpu_conf_init(&conf);
-        conf.sched_policy_name = "pgreedy";
+        conf.sched_policy_name = "peager";
 
 	ret = starpu_init(&conf);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;

+ 2 - 2
tests/sched_policies/data_locality.c

@@ -154,7 +154,7 @@ extern struct starpu_sched_policy _starpu_sched_dmda_policy;
 //extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
 //extern struct starpu_sched_policy _starpu_sched_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
-//extern struct starpu_sched_policy _starpu_sched_pgreedy_policy;
+//extern struct starpu_sched_policy _starpu_sched_peager_policy;
 
 static struct starpu_sched_policy *policies[] =
 {
@@ -167,7 +167,7 @@ static struct starpu_sched_policy *policies[] =
 	//&_starpu_sched_random_policy,
 	//&_starpu_sched_eager_policy,
 	&_starpu_sched_parallel_heft_policy,
-	//&_starpu_sched_pgreedy_policy
+	//&_starpu_sched_peager_policy
 };
 
 int

+ 2 - 2
tests/sched_policies/execute_all_tasks.c

@@ -34,7 +34,7 @@ extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
 extern struct starpu_sched_policy _starpu_sched_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
-extern struct starpu_sched_policy _starpu_sched_pgreedy_policy;
+extern struct starpu_sched_policy _starpu_sched_peager_policy;
 
 static struct starpu_sched_policy *policies[] =
 {
@@ -47,7 +47,7 @@ static struct starpu_sched_policy *policies[] =
 	&_starpu_sched_random_policy,
 	&_starpu_sched_eager_policy,
 	&_starpu_sched_parallel_heft_policy,
-	&_starpu_sched_pgreedy_policy
+	&_starpu_sched_peager_policy
 };
 
 static void

+ 2 - 2
tests/sched_policies/simple_cpu_gpu_sched.c

@@ -193,7 +193,7 @@ extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
 extern struct starpu_sched_policy _starpu_sched_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
-extern struct starpu_sched_policy _starpu_sched_pgreedy_policy;
+extern struct starpu_sched_policy _starpu_sched_peager_policy;
 */
 extern struct starpu_sched_policy _starpu_sched_dmda_policy;
 
@@ -209,7 +209,7 @@ static struct starpu_sched_policy *policies[] =
 	//&_starpu_sched_random_policy,
 	//&_starpu_sched_eager_policy,
 	//&_starpu_sched_parallel_heft_policy,
-	//&_starpu_sched_pgreedy_policy
+	//&_starpu_sched_peager_policy
 };
 
 int

+ 2 - 2
tests/sched_policies/simple_deps.c

@@ -92,7 +92,7 @@ extern struct starpu_sched_policy _starpu_sched_dmda_ready_policy;
 extern struct starpu_sched_policy _starpu_sched_dmda_sorted_policy;
 extern struct starpu_sched_policy _starpu_sched_eager_policy;
 extern struct starpu_sched_policy _starpu_sched_parallel_heft_policy;
-extern struct starpu_sched_policy _starpu_sched_pgreedy_policy;
+extern struct starpu_sched_policy _starpu_sched_peager_policy;
 
 static struct starpu_sched_policy *policies[] =
 {
@@ -105,7 +105,7 @@ static struct starpu_sched_policy *policies[] =
 	&_starpu_sched_random_policy,
 	&_starpu_sched_eager_policy,
 	&_starpu_sched_parallel_heft_policy,
-	&_starpu_sched_pgreedy_policy
+	&_starpu_sched_peager_policy
 };
 
 int