瀏覽代碼

unsigned ctx id

Andra Hugo 14 年之前
父節點
當前提交
f5ac78732b

+ 1 - 0
configure.ac

@@ -1087,6 +1087,7 @@ AC_OUTPUT([
 	examples/Makefile
 	examples/starpufft/Makefile
 	examples/stencil/Makefile
+	examples/stencil_ctx/Makefile
 	tests/Makefile
 	doc/Makefile
 	mpi/Makefile

+ 1 - 1
examples/Makefile.am

@@ -22,7 +22,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/examples/ -I$(top_builddi
 
 TESTS	=	$(check_PROGRAMS)
 
-SUBDIRS = stencil
+SUBDIRS = stencil stencil_ctx
 
 if STARPU_HAVE_FFTW
 if STARPU_HAVE_FFTWL

+ 38 - 1
examples/cholesky_and_lu/cholesky/cholesky.h

@@ -71,7 +71,7 @@ void chol_cublas_codelet_update_u21(void *descr[], void *_args);
 void chol_cublas_codelet_update_u22(void *descr[], void *_args);
 #endif
 
-double run_cholesky_implicit(int sched_ctx, int argc, char **argv, double *timing, pthread_barrier_t *barrier);
+double run_cholesky_implicit(int sched_ctx, int start, int argc, char **argv, double *timing, pthread_barrier_t *barrier);
 
 extern struct starpu_perfmodel_t chol_model_11;
 extern struct starpu_perfmodel_t chol_model_21;
@@ -114,4 +114,41 @@ static void __attribute__((unused)) parse_args(int argc, char **argv, unsigned *
 	}
 }
 
+static void __attribute__((unused)) parse_args_ctx(int start, int argc, char **argv, unsigned *size, unsigned *nblocks)
+{
+	int i;
+	for (i = start; i < argc; i++) {
+		if (strcmp(argv[i], "-size") == 0) {
+		        char *argptr;
+			(*size) = strtol(argv[++i], &argptr, 10);
+		}
+
+		if (strcmp(argv[i], "-nblocks") == 0) {
+		        char *argptr;
+			(*nblocks) = strtol(argv[++i], &argptr, 10);
+		}
+
+		if (strcmp(argv[i], "-nbigblocks") == 0) {
+		        char *argptr;
+			nbigblocks = strtol(argv[++i], &argptr, 10);
+		}
+
+		if (strcmp(argv[i], "-pin") == 0) {
+			pinned = 1;
+		}
+
+		if (strcmp(argv[i], "-no-prio") == 0) {
+			noprio = 1;
+		}
+
+		if (strcmp(argv[i], "-check") == 0) {
+			check = 1;
+		}
+
+		if (strcmp(argv[i], "-h") == 0) {
+			printf("usage : %s [-pin] [-size size] [-nblocks nblocks] [-check]\n", argv[0]);
+		}
+	}
+}
+
 #endif // __DW_CHOLESKY_H__

+ 4 - 4
examples/cholesky_and_lu/cholesky/cholesky_implicit.c

@@ -142,7 +142,7 @@ static double _cholesky(starpu_data_handle dataA, unsigned nblocks, int sched_ct
 		}
 	}
 
-	if(sched_ctx != -1)
+	if(sched_ctx != 0)
 		starpu_wait_for_all_tasks_of_sched_ctx(sched_ctx);
 	else
 		starpu_task_wait_for_all();
@@ -184,7 +184,7 @@ static double cholesky(float *matA, unsigned size, unsigned ld, unsigned nblocks
 	return _cholesky(dataA, nblocks, sched_ctx, timing);
 }
 
-double run_cholesky_implicit(int sched_ctx, int argc, char **argv, double *timing, pthread_barrier_t *barrier)
+double run_cholesky_implicit(int sched_ctx, int start, int argc, char **argv, double *timing, pthread_barrier_t *barrier)
 {
 	/* create a simple definite positive symetric matrix example
 	 *
@@ -193,7 +193,7 @@ double run_cholesky_implicit(int sched_ctx, int argc, char **argv, double *timin
 
 	unsigned size = 4 * 1024;
 	unsigned nblocks = 16;
-	parse_args(argc, argv, &size, &nblocks);
+	parse_args_ctx(start, argc, argv, &size, &nblocks);
 
 	//	starpu_init(NULL);
 
@@ -229,7 +229,7 @@ double run_cholesky_implicit(int sched_ctx, int argc, char **argv, double *timin
 		printf("\n");
 	}
 #endif
-	if(barrier != NULL)
+ 	if(barrier != NULL)
 	  pthread_barrier_wait(barrier);
 	double gflops = cholesky(mat, size, size, nblocks, sched_ctx, timing);
 

+ 20 - 7
examples/cholesky_and_lu/cholesky_and_lu.c

@@ -2,6 +2,7 @@
 #include <pthread.h>
 
 typedef struct {
+  int start;
   int argc;
   char **argv;
   int ctx;
@@ -27,7 +28,7 @@ void* func_cholesky(void *val){
   double timing = 0;
   for(i = 0; i < NSAMPLES; i++)
     {
-      rv->flops += run_cholesky_implicit(sched_ctx, p->argc, p->argv, &timing, (sched_ctx == -1 ? NULL : &barrier));
+      rv->flops += run_cholesky_implicit(sched_ctx, p->start, p->argc, p->argv, &timing, (sched_ctx == -1 ? NULL : &barrier));
       rv->avg_timing += timing;
     }
 
@@ -41,11 +42,20 @@ void cholesky_vs_cholesky(params *p1, params *p2, params *p3){
   starpu_init(NULL);
   starpu_helper_cublas_init();
 
-  int procs[] = {1, 2, 3, 4, 5, 6};
-  p1->ctx = starpu_create_sched_ctx("heft", procs, 6, "cholesky1");
-
-  int procs2[] = {0, 7, 8, 9, 10, 11};
-  p2->ctx = starpu_create_sched_ctx("heft", procs2, 6, "cholesky2");
+  int procs[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+		 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+		 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+		 39, 40, 41, 42, 43, 44, 45, 46, 47,
+		 48, 49, 50, 51, 52, 53, 54,
+		 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+		 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,  78,
+		 79, 80, 81, 82, 83, 84, 85};
+  int id = starpu_create_sched_ctx("heft", NULL, -1, "cholesky");
+  p1->ctx = id;
+
+  int procs2[] =  {86, 87, 88, 89, 90,
+		   91, 92, 93, 94, 95};
+  p2->ctx = id ;//= starpu_create_sched_ctx("heft", procs2, 10, "cholesky2");
 
   pthread_t tid[2];
   pthread_barrier_init(&barrier, NULL, 2);
@@ -103,11 +113,14 @@ void cholesky_vs_cholesky(params *p1, params *p2, params *p3){
 
 int main(int argc, char **argv)
 {
+  //  printf("argc = %d\n", argc);
   params p1;
-  p1.argc = argc;
+  p1.start = 1;
+  p1.argc = 5;
   p1.argv = argv;
 
   params p2;
+  p2.start = 5;
   p2.argc = argc;
   p2.argv = argv;
 

+ 4 - 4
examples/stencil/Makefile.am

@@ -17,10 +17,10 @@ AM_CFLAGS = $(HWLOC_CFLAGS)
 LIBS = $(top_builddir)/src/libstarpu.la $(HWLOC_LIBS) @LIBS@
 AM_CPPFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/examples/ -I$(top_builddir)/include
 
-if USE_MPI
-LIBS += $(top_builddir)/mpi/libstarpumpi.la
-AM_CPPFLAGS += -I$(top_srcdir)/mpi/
-endif
+# if USE_MPI
+# LIBS += $(top_builddir)/mpi/libstarpumpi.la
+# AM_CPPFLAGS += -I$(top_srcdir)/mpi/
+# endif
 
 CC = $(CC_OR_MPICC)
 

+ 1 - 1
include/starpu_config.h.in

@@ -6,7 +6,7 @@
 #undef STARPU_USE_OPENCL
 #undef STARPU_USE_GORDON
 
-#undef STARPU_USE_MPI
+//#undef STARPU_USE_MPI
 
 #undef STARPU_ATLAS
 #undef STARPU_GOTO

+ 7 - 7
include/starpu_scheduler.h

@@ -64,13 +64,13 @@ struct starpu_machine_topology_s {
  * field of the starpu_conf structure passed to the starpu_init function. */
 struct starpu_sched_policy_s {
 	/* Initialize the scheduling policy. */
-	void (*init_sched)(int);
+	void (*init_sched)(unsigned);
 
 	/* Cleanup the scheduling policy. */
-	void (*deinit_sched)(int);
+	void (*deinit_sched)(unsigned);
 
 	/* Insert a task into the scheduler. */
-        int (*push_task)(struct starpu_task *, int);
+        int (*push_task)(struct starpu_task *, unsigned);
 	/* Notify the scheduler that a task was pushed on the worker. This
 	 * method is called when a task that was explicitely assigned to a
 	 * worker is scheduled. This method therefore permits to keep the state
@@ -79,7 +79,7 @@ struct starpu_sched_policy_s {
 	void (*push_task_notify)(struct starpu_task *, int workerid);
 
 	/* Insert a priority task into the scheduler. */
-        int (*push_prio_task)(struct starpu_task *, int);
+        int (*push_prio_task)(struct starpu_task *, unsigned);
 
 	/* Get a task from the scheduler. The mutex associated to the worker is
 	 * already taken when this method is called. */
@@ -103,11 +103,11 @@ struct starpu_sched_policy_s {
 
 int starpu_create_sched_ctx(const char *policy_name, int *workerids_in_ctx, int nworkerids_in_ctx, const char *sched_name);
 
-void starpu_delete_sched_ctx(int sched_ctx);
+void starpu_delete_sched_ctx(unsigned sched_ctx_id);
 
-void starpu_add_workers_to_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx, int sched_ctx);
+void starpu_add_workers_to_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx, unsigned sched_ctx);
 
-void starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx, int sched_ctx);
+void starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx, unsigned sched_ctx);
 
 /* When there is no available task for a worker, StarPU blocks this worker on a
 condition variable. This function specifies which condition variable (and the

+ 4 - 4
include/starpu_task.h

@@ -158,7 +158,7 @@ struct starpu_task {
 	 * NULL. */
 	void *starpu_private;
      
-        int sched_ctx;
+        unsigned sched_ctx;
   
 };
 
@@ -184,7 +184,7 @@ struct starpu_task {
 	.profiling_info = NULL,				\
 	.predicted = -1.0,				\
 	.starpu_private = NULL,				\
-	.sched_ctx = -1					\
+	.sched_ctx = 0					\
 };
 
 /*
@@ -247,7 +247,7 @@ struct starpu_task *starpu_task_create(void);
  * allocated task results in an undefined behaviour. */
 void starpu_task_destroy(struct starpu_task *task);
 int starpu_task_submit(struct starpu_task *task);
-int starpu_task_submit_to_ctx(struct starpu_task *task, int sched_ctx);
+int starpu_task_submit_to_ctx(struct starpu_task *task, unsigned sched_ctx);
 
 /* This function blocks until the task was executed. It is not possible to
  * synchronize with a task more than once. It is not possible to wait
@@ -262,7 +262,7 @@ int starpu_task_wait_for_all(void);
 
 /* This function waits until all the tasks that were already submitted to a specific
  * context have been executed. */
-int starpu_wait_for_all_tasks_of_sched_ctx(int sched_ctx);
+int starpu_wait_for_all_tasks_of_sched_ctx(unsigned sched_ctx_id);
 
 void starpu_display_codelet_stats(struct starpu_codelet_t *cl);
 

+ 10 - 31
src/core/sched_ctx.c

@@ -203,7 +203,7 @@ static void _starpu_remove_sched_ctx_from_worker(struct starpu_worker_s *workera
 	return;
 }
 
-void starpu_delete_sched_ctx(int sched_ctx_id)
+void starpu_delete_sched_ctx(unsigned sched_ctx_id)
 {
 	if(!starpu_wait_for_all_tasks_of_sched_ctx(sched_ctx_id))
 	  {
@@ -229,26 +229,12 @@ void starpu_delete_sched_ctx(int sched_ctx_id)
 void _starpu_delete_all_sched_ctxs()
 {
 	struct starpu_machine_config_s *config = _starpu_get_machine_config();
-	unsigned nworkers = config->topology.nworkers;
-	
-	unsigned i, j;
-	struct starpu_sched_ctx *sched_ctx = NULL;
-	struct starpu_worker_s *workerarg = NULL;
-	for(i = 0; i < nworkers; i++)
+	unsigned nsched_ctxs = config->topology.nsched_ctxs;
+	unsigned i;
+
+	for(i = 0; i < nsched_ctxs; i++)
 	  {
-		workerarg = _starpu_get_worker_struct(i);
-		for(j = 0; j < workerarg->nctxs; j++)
-		  {
-			sched_ctx = workerarg->sched_ctx[j];
-			if(sched_ctx != NULL)
-			  {
-				free(sched_ctx->sched_policy);
-				sched_ctx->sched_policy = NULL;
-				sched_ctx = NULL;
-				
-			  }
-		  }
-		workerarg->nctxs = 0;
+	    starpu_delete_sched_ctx((int)i);
 	  }
 	return;
 }
@@ -363,7 +349,7 @@ static void _starpu_add_workers_to_sched_ctx(int *workerids_in_ctx, int nworkeri
 }
 
 void starpu_add_workers_to_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx,
-				     int sched_ctx_id)
+				     unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -460,7 +446,7 @@ static void _starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nwo
 }
 
 void starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nworkerids_in_ctx, 
-					  int sched_ctx_id)
+					  unsigned sched_ctx_id)
 {
 	  /* wait for the workers concerned by the change of contex                       
 	   * to finish their work in the previous context */
@@ -478,7 +464,7 @@ void starpu_remove_workers_from_sched_ctx(int *workerids_in_ctx, int nworkerids_
 
 }
 
-int starpu_wait_for_all_tasks_of_sched_ctx(int sched_ctx_id)
+int starpu_wait_for_all_tasks_of_sched_ctx(unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	
@@ -488,11 +474,8 @@ int starpu_wait_for_all_tasks_of_sched_ctx(int sched_ctx_id)
 	PTHREAD_MUTEX_LOCK(&sched_ctx->submitted_mutex);
 	
 	
-	while (sched_ctx->nsubmitted > 0){
-	  printf("wait %s\n", sched_ctx->sched_name);
+	while (sched_ctx->nsubmitted > 0)
 	  PTHREAD_COND_WAIT(&sched_ctx->submitted_cond, &sched_ctx->submitted_mutex);
-	  printf("wait finished %s\n", sched_ctx->sched_name);
-	}
 	
 	PTHREAD_MUTEX_UNLOCK(&sched_ctx->submitted_mutex);
 	
@@ -501,8 +484,6 @@ int starpu_wait_for_all_tasks_of_sched_ctx(int sched_ctx_id)
 
 void _starpu_decrement_nsubmitted_tasks_of_sched_ctx(struct starpu_sched_ctx *sched_ctx)
 {
-  //  if(sched_ctx->sched_ctx_id == 5)
-  // printf("decr tasks to %s : %d \n", sched_ctx->sched_name, sched_ctx->nsubmitted);
   PTHREAD_MUTEX_LOCK(&sched_ctx->submitted_mutex);
 
   if (--sched_ctx->nsubmitted == 0)
@@ -513,8 +494,6 @@ void _starpu_decrement_nsubmitted_tasks_of_sched_ctx(struct starpu_sched_ctx *sc
 
 void _starpu_increment_nsubmitted_tasks_of_sched_ctx(struct starpu_sched_ctx *sched_ctx)
 {
-  //if(sched_ctx->sched_ctx_id == 5)
-  //printf("incr tasks to %s : %d \n", sched_ctx->sched_name, sched_ctx->nsubmitted);
   PTHREAD_MUTEX_LOCK(&sched_ctx->submitted_mutex);
 
   sched_ctx->nsubmitted++;

+ 6 - 5
src/core/task.c

@@ -78,7 +78,7 @@ void starpu_task_init(struct starpu_task *task)
 
 	task->starpu_private = NULL;
 
-	task->sched_ctx = -1;
+	task->sched_ctx = _starpu_get_initial_sched_ctx()->sched_ctx_id;
 }
 
 /* Free all the ressources allocated for a task, without deallocating the task
@@ -217,9 +217,10 @@ int _starpu_submit_job(starpu_job_t j, unsigned do_not_increment_nsubmitted)
 }
 
 /* application should submit new tasks to StarPU through this function */
-int starpu_task_submit_to_ctx(struct starpu_task *task, int sched_ctx)
+int starpu_task_submit_to_ctx(struct starpu_task *task, unsigned sched_ctx)
 {
-        if(task->sched_ctx == -1 && sched_ctx != -1)
+	unsigned init_sched_ctx = _starpu_get_initial_sched_ctx()->sched_ctx_id;
+        if(task->sched_ctx ==  init_sched_ctx && sched_ctx != init_sched_ctx)
 	  task->sched_ctx = sched_ctx;
 
 	int ret;
@@ -288,8 +289,8 @@ int starpu_task_submit_to_ctx(struct starpu_task *task, int sched_ctx)
 }
 
 int starpu_task_submit(struct starpu_task *task){
-  struct starpu_sched_ctx *sched_ctx = _starpu_get_initial_sched_ctx();
-   return  starpu_task_submit_to_ctx(task, sched_ctx->sched_ctx_id);
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_initial_sched_ctx();
+	return  starpu_task_submit_to_ctx(task, sched_ctx->sched_ctx_id);
 }
 
 void starpu_display_codelet_stats(struct starpu_codelet_t *cl)

+ 1 - 1
src/core/workers.c

@@ -620,7 +620,7 @@ struct starpu_worker_s *_starpu_get_worker_struct(unsigned id)
 	return &config.workers[id];
 }
 
-struct starpu_sched_ctx *_starpu_get_sched_ctx(int id)
+struct starpu_sched_ctx *_starpu_get_sched_ctx(unsigned id)
 {
 	return &config.sched_ctxs[id];
 }

+ 1 - 1
src/core/workers.h

@@ -208,7 +208,7 @@ struct starpu_worker_s *_starpu_get_worker_struct(unsigned id);
 
 /* Returns the starpu_sched_ctx structure that descriebes the state of the 
  * specified ctx */
-struct starpu_sched_ctx *_starpu_get_sched_ctx(int id);
+struct starpu_sched_ctx *_starpu_get_sched_ctx(unsigned id);
 
 
 struct starpu_combined_worker_s *_starpu_get_combined_worker_struct(unsigned id);

+ 8 - 8
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -532,19 +532,19 @@ static int _dmda_push_task(struct starpu_task *task, unsigned prio, struct starp
 	return push_task_on_best_worker(task, best, model_best, prio);
 }
 
-static int dmda_push_sorted_task(struct starpu_task *task, int sched_ctx_id)
+static int dmda_push_sorted_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	return _dmda_push_task(task, 2, sched_ctx);
 }
 
-static int dm_push_prio_task(struct starpu_task *task, int sched_ctx_id)
+static int dm_push_prio_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	return _dm_push_task(task, 1, sched_ctx);
 }
 
-static int dm_push_task(struct starpu_task *task, int sched_ctx_id)
+static int dm_push_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority > 0)
@@ -553,13 +553,13 @@ static int dm_push_task(struct starpu_task *task, int sched_ctx_id)
 	return _dm_push_task(task, 0, sched_ctx);
 }
 
-static int dmda_push_prio_task(struct starpu_task *task, int sched_ctx_id)
+static int dmda_push_prio_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	return _dmda_push_task(task, 1, sched_ctx);
 }
 
-static int dmda_push_task(struct starpu_task *task, int sched_ctx_id)
+static int dmda_push_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority > 0)
@@ -568,7 +568,7 @@ static int dmda_push_task(struct starpu_task *task, int sched_ctx_id)
 	return _dmda_push_task(task, 0, sched_ctx);
 }
 
-static void initialize_dmda_policy(int sched_ctx_id) 
+static void initialize_dmda_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	nworkers = sched_ctx->nworkers_in_ctx;
@@ -598,7 +598,7 @@ static void initialize_dmda_policy(int sched_ctx_id)
 	}
 }
 
-static void initialize_dmda_sorted_policy(int sched_ctx_id)
+static void initialize_dmda_sorted_policy(unsigned sched_ctx_id)
 {
 	initialize_dmda_policy(sched_ctx_id);
 
@@ -607,7 +607,7 @@ static void initialize_dmda_sorted_policy(int sched_ctx_id)
 	starpu_sched_set_max_priority(INT_MAX);
 }
 
-static void deinitialize_dmda_policy(int sched_ctx_id) 
+static void deinitialize_dmda_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
         unsigned workerid;

+ 4 - 4
src/sched_policies/eager_central_policy.c

@@ -29,7 +29,7 @@ static struct starpu_fifo_taskq_s *fifo;
 static pthread_cond_t sched_cond;
 static pthread_mutex_t sched_mutex;
 
-static void initialize_eager_center_policy(int sched_ctx_id) 
+static void initialize_eager_center_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -49,7 +49,7 @@ static void initialize_eager_center_policy(int sched_ctx_id)
 	}
 }
 
-static void deinitialize_eager_center_policy(__attribute__ ((unused)) int sched_ctx_id) 
+static void deinitialize_eager_center_policy(__attribute__ ((unused)) unsigned sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -57,7 +57,7 @@ static void deinitialize_eager_center_policy(__attribute__ ((unused)) int sched_
 	_starpu_destroy_fifo(fifo);
 }
 
-static int push_task_eager_policy(struct starpu_task *task, int sched_ctx_id)
+static int push_task_eager_policy(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -72,7 +72,7 @@ static int push_task_eager_policy(struct starpu_task *task, int sched_ctx_id)
 	return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
 }
 
-static int push_prio_task_eager_policy(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
+static int push_prio_task_eager_policy(struct starpu_task *task, __attribute__ ((unused)) unsigned sched_ctx_id)
 {
 	return _starpu_fifo_push_prio_task(fifo, &sched_mutex, &sched_cond, task);
 }

+ 3 - 3
src/sched_policies/eager_central_priority_policy.c

@@ -74,7 +74,7 @@ static void _starpu_destroy_priority_taskq(struct starpu_priority_taskq_s *prior
 	free(priority_queue);
 }
 
-static void initialize_eager_center_priority_policy(int sched_ctx_id) 
+static void initialize_eager_center_priority_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -98,7 +98,7 @@ static void initialize_eager_center_priority_policy(int sched_ctx_id)
 	}
 }
 
-static void deinitialize_eager_center_priority_policy(__attribute__ ((unused)) int sched_ctx_id) 
+static void deinitialize_eager_center_priority_policy(__attribute__ ((unused)) unsigned sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -106,7 +106,7 @@ static void deinitialize_eager_center_priority_policy(__attribute__ ((unused)) i
 	_starpu_destroy_priority_taskq(taskq);
 }
 
-static int _starpu_priority_push_task(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
+static int _starpu_priority_push_task(struct starpu_task *task, __attribute__ ((unused)) unsigned sched_ctx_id)
 {
 	/* wake people waiting for a task */
 	PTHREAD_MUTEX_LOCK(&global_sched_mutex);

+ 8 - 8
src/sched_policies/heft.c

@@ -40,7 +40,7 @@ static double exp_end[STARPU_NMAXWORKERS];
 static double exp_len[STARPU_NMAXWORKERS];
 static double ntasks[STARPU_NMAXWORKERS];
 
-static void heft_init(int sched_ctx_id)
+static void heft_init(unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	unsigned nworkers = sched_ctx->nworkers_in_ctx;
@@ -190,6 +190,8 @@ static void compute_all_performance_predictions(struct starpu_task *task,
 	local_power[worker_in_ctx] = starpu_task_expected_power(task, perf_arch);
       }
 
+      /* printf("%d(in ctx%d): local task len = %2.2f locald data penalty = %2.2f local_power = %2.2f\n", worker, worker_in_ctx, local_task_length[worker_in_ctx], local_data_penalty[worker_in_ctx], local_power[worker_in_ctx]); */
+
       double ntasks_end = ntasks[worker] / starpu_worker_get_relative_speedup(perf_arch);
 
       if (ntasks_best == -1
@@ -232,7 +234,7 @@ static void compute_all_performance_predictions(struct starpu_task *task,
   *max_exp_endp = max_exp_end;
 }
 
-static int _heft_push_task(struct starpu_task *task, unsigned prio, int sched_ctx_id)
+static int _heft_push_task(struct starpu_task *task, unsigned prio, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	unsigned worker, worker_in_ctx;
@@ -242,9 +244,6 @@ static int _heft_push_task(struct starpu_task *task, unsigned prio, int sched_ct
 	   there is no performance prediction available yet */
 	int forced_best;
 
-	//        struct starpu_machine_config_s *config = (struct starpu_machine_config_s *)_starpu_get_machine_config();                                                            
-	//        int nworkers = config->topology.nworkers;
-
 	unsigned nworkers_in_ctx = sched_ctx->nworkers_in_ctx;
 	double local_task_length[nworkers_in_ctx];
 	double local_data_penalty[nworkers_in_ctx];
@@ -308,6 +307,7 @@ static int _heft_push_task(struct starpu_task *task, unsigned prio, int sched_ct
 			best = worker;
 			best_id_in_ctx = worker_in_ctx;
 		}
+
 	}
 
 
@@ -344,12 +344,12 @@ static int _heft_push_task(struct starpu_task *task, unsigned prio, int sched_ct
 	return push_task_on_best_worker(task, best, model_best, prio);
 }
 
-static int heft_push_prio_task(struct starpu_task *task, int sched_ctx_id)
+static int heft_push_prio_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
         return _heft_push_task(task, 1, sched_ctx_id);
 }
 
-static int heft_push_task(struct starpu_task *task, int sched_ctx_id)
+static int heft_push_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	if (task->priority > 0)
         	  return _heft_push_task(task, 1, sched_ctx_id);
@@ -357,7 +357,7 @@ static int heft_push_task(struct starpu_task *task, int sched_ctx_id)
 	return _heft_push_task(task, 0, sched_ctx_id);
 }
 
-static void heft_deinit(int sched_ctx_id) 
+static void heft_deinit(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
         unsigned workerid;

+ 3 - 3
src/sched_policies/parallel_greedy.c

@@ -34,7 +34,7 @@ static int possible_combinations_cnt[STARPU_NMAXWORKERS];
 static int possible_combinations[STARPU_NMAXWORKERS][10];
 static int possible_combinations_size[STARPU_NMAXWORKERS][10];
 
-static void initialize_pgreedy_policy(int sched_ctx_id) 
+static void initialize_pgreedy_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -137,7 +137,7 @@ static void initialize_pgreedy_policy(int sched_ctx_id)
 #endif
 }
 
-static void deinitialize_pgreedy_policy(__attribute__ ((unused)) int sched_ctx_id) 
+static void deinitialize_pgreedy_policy(__attribute__ ((unused)) unsigned sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -145,7 +145,7 @@ static void deinitialize_pgreedy_policy(__attribute__ ((unused)) int sched_ctx_i
 	_starpu_destroy_fifo(fifo);
 }
 
-static int push_task_pgreedy_policy(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
+static int push_task_pgreedy_policy(struct starpu_task *task, __attribute__ ((unused)) unsigned sched_ctx_id)
 {
 	return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
 }

+ 4 - 4
src/sched_policies/parallel_heft.c

@@ -375,14 +375,14 @@ static int _parallel_heft_push_task(struct starpu_task *task, unsigned prio, str
 	return push_task_on_best_worker(task, best, model_best, prio);
 }
 
-static int parallel_heft_push_prio_task(struct starpu_task *task, int sched_ctx_id)
+static int parallel_heft_push_prio_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
 	return _parallel_heft_push_task(task, 1, sched_ctx);
 }
 
-static int parallel_heft_push_task(struct starpu_task *task, int sched_ctx_id)
+static int parallel_heft_push_task(struct starpu_task *task, unsigned sched_ctx_id)
 { 
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority == STARPU_MAX_PRIO)
@@ -391,7 +391,7 @@ static int parallel_heft_push_task(struct starpu_task *task, int sched_ctx_id)
 	return _parallel_heft_push_task(task, 0, sched_ctx);
 }
 
-static void initialize_parallel_heft_policy(int sched_ctx_id) 
+static void initialize_parallel_heft_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
@@ -460,7 +460,7 @@ static void initialize_parallel_heft_policy(int sched_ctx_id)
 	}
 }
 
-static void deinitialize_parallel_heft_policy(int sched_ctx_id) 
+static void deinitialize_parallel_heft_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 

+ 3 - 3
src/sched_policies/random_policy.c

@@ -70,21 +70,21 @@ static int _random_push_task(struct starpu_task *task, unsigned prio, struct sta
 	return n;
 }
 
-static int random_push_prio_task(struct starpu_task *task, int sched_ctx_id)
+static int random_push_prio_task(struct starpu_task *task, unsigned sched_ctx_id)
 {	
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
         return _random_push_task(task, 1, sched_ctx);
 }
 
-static int random_push_task(struct starpu_task *task, int sched_ctx_id)
+static int random_push_task(struct starpu_task *task, unsigned sched_ctx_id)
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 
         return _random_push_task(task, 0, sched_ctx);
 }
 
-static void initialize_random_policy(int sched_ctx_id) 
+static void initialize_random_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 

+ 2 - 2
src/sched_policies/work_stealing_policy.c

@@ -168,7 +168,7 @@ static struct starpu_task *ws_pop_task(void)
 	return task;
 }
 
-int ws_push_task(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
+int ws_push_task(struct starpu_task *task, __attribute__ ((unused)) unsigned sched_ctx_id)
 {
 	starpu_job_t j = _starpu_get_job_associated_to_task(task);
 
@@ -192,7 +192,7 @@ int ws_push_task(struct starpu_task *task, __attribute__ ((unused)) int sched_ct
         return 0;
 }
 
-static void initialize_ws_policy(int sched_ctx_id) 
+static void initialize_ws_policy(unsigned sched_ctx_id) 
 {
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);