Browse Source

fixed some warnings

Andra Hugo 14 years ago
parent
commit
6bb4335a7d

+ 1 - 1
src/core/dependencies/tags.c

@@ -329,7 +329,7 @@ int starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id)
 	PTHREAD_MUTEX_LOCK(&cg->succ.succ_apps.cg_mutex);
 
 	while (!cg->succ.succ_apps.completed){
-	  printf("cond wait\n");
+	  //	  printf("cond wait\n");
 		PTHREAD_COND_WAIT(&cg->succ.succ_apps.cg_cond, &cg->succ.succ_apps.cg_mutex);
 	}
 

+ 10 - 3
src/core/sched_ctx.c

@@ -119,7 +119,7 @@ static int set_changing_ctx_flag(starpu_worker_status changing_ctx, int nworkeri
 	struct starpu_machine_config_s *config = _starpu_get_machine_config();
 
 	int i;
-	int nworkers = nworkerids_in_ctx == -1 ? config->topology.nworkers : nworkerids_in_ctx;
+	int nworkers = nworkerids_in_ctx == -1 ? (int)config->topology.nworkers : nworkerids_in_ctx;
   
 	struct starpu_worker_s *worker = NULL;
 	pthread_mutex_t *changing_ctx_mutex = NULL;
@@ -274,7 +274,7 @@ int starpu_wait_for_all_tasks_of_workers(int *workerids_in_ctx, int nworkerids_i
 	int ret_val = 0;
 	
 	struct starpu_machine_config_s *config = _starpu_get_machine_config();
-	int nworkers = nworkerids_in_ctx == -1 ? config->topology.nworkers : nworkerids_in_ctx;
+	int nworkers = nworkerids_in_ctx == -1 ? (int)config->topology.nworkers : nworkerids_in_ctx;
 	
 	int workerid = -1;
 	int i, n;
@@ -488,8 +488,11 @@ 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)
+	while (sched_ctx->nsubmitted > 0){
+	  printf("wait %s\n", sched_ctx->sched_name);
 	  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);
 	
@@ -498,6 +501,8 @@ 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)
@@ -508,6 +513,8 @@ 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++;

+ 1 - 2
src/core/topology.c

@@ -437,13 +437,13 @@ static int _starpu_init_machine_config(struct starpu_machine_config_s *config,
 /* we put the CPU section after the accelerator : in case there was an
  * accelerator found, we devote one cpu */
 #ifdef STARPU_USE_CPU
+	explicitval = -1;
 	if (user_conf && (user_conf->ncpus != -1)) {
 		explicitval = user_conf->ncpus;
 	}
 	else {
 		explicitval = starpu_get_env_number("STARPU_NCPUS");
 	}
-
 	if (explicitval < 0) {
 		unsigned already_busy_cpus = (topology->ngordon_spus?1:0) + topology->ncudagpus;
 		long avail_cpus = topology->nhwcpus - (use_accelerator?already_busy_cpus:0);
@@ -454,7 +454,6 @@ static int _starpu_init_machine_config(struct starpu_machine_config_s *config,
 		STARPU_ASSERT(topology->ncpus <= STARPU_NMAXCPUS);
 	}
 	STARPU_ASSERT(topology->ncpus + topology->nworkers <= STARPU_NMAXWORKERS);
-
 	unsigned cpu;
 	for (cpu = 0; cpu < topology->ncpus; cpu++)
 	{

+ 1 - 0
src/core/workers.c

@@ -227,6 +227,7 @@ static void _starpu_launch_drivers(struct starpu_machine_config_s *config)
 				workerarg->set = &gordon_worker_set;
 				gordon_worker_set.joined = 0;
 				workerarg->worker_is_running = 1;
+				printf("%d launched", workerarg->workerid);
 
 				break;
 #endif

+ 17 - 10
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -532,39 +532,45 @@ 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, struct starpu_sched_ctx *sched_ctx)
+static int dmda_push_sorted_task(struct starpu_task *task, int sched_ctx_id)
 {
-  return _dmda_push_task(task, 2, sched_ctx);
+	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, struct starpu_sched_ctx *sched_ctx)
+static int dm_push_prio_task(struct starpu_task *task, int 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, struct starpu_sched_ctx *sched_ctx)
+static int dm_push_task(struct starpu_task *task, int sched_ctx_id)
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority > 0)
 		return _dm_push_task(task, 1, sched_ctx);
 
 	return _dm_push_task(task, 0, sched_ctx);
 }
 
-static int dmda_push_prio_task(struct starpu_task *task, struct starpu_sched_ctx *sched_ctx)
+static int dmda_push_prio_task(struct starpu_task *task, int 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, struct starpu_sched_ctx *sched_ctx)
+static int dmda_push_task(struct starpu_task *task, int sched_ctx_id)
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority > 0)
 		return _dmda_push_task(task, 1, sched_ctx);
 
 	return _dmda_push_task(task, 0, sched_ctx);
 }
 
-static void initialize_dmda_policy(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_dmda_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	nworkers = sched_ctx->nworkers_in_ctx;
 
 	const char *strval_alpha = getenv("STARPU_SCHED_ALPHA");
@@ -592,17 +598,18 @@ static void initialize_dmda_policy(struct starpu_sched_ctx *sched_ctx)
 	}
 }
 
-static void initialize_dmda_sorted_policy(struct starpu_sched_ctx *sched_ctx)
+static void initialize_dmda_sorted_policy(int sched_ctx_id)
 {
-	initialize_dmda_policy(sched_ctx);
+	initialize_dmda_policy(sched_ctx_id);
 
 	/* The application may use any integer */
 	starpu_sched_set_min_priority(INT_MIN);
 	starpu_sched_set_max_priority(INT_MAX);
 }
 
-static void deinitialize_dmda_policy(struct starpu_sched_ctx *sched_ctx) 
+static void deinitialize_dmda_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
         unsigned workerid;
 	int workerid_in_ctx;
         int nworkers = sched_ctx->nworkers_in_ctx;

+ 10 - 5
src/sched_policies/eager_central_policy.c

@@ -29,8 +29,10 @@ 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(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_eager_center_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	/* there is only a single queue in that trivial design */
 	fifo = _starpu_create_fifo();
 
@@ -47,7 +49,7 @@ static void initialize_eager_center_policy(struct starpu_sched_ctx *sched_ctx)
 	}
 }
 
-static void deinitialize_eager_center_policy(struct starpu_sched_ctx *sched_ctx) 
+static void deinitialize_eager_center_policy(__attribute__ ((unused)) int sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -55,8 +57,10 @@ static void deinitialize_eager_center_policy(struct starpu_sched_ctx *sched_ctx)
 	_starpu_destroy_fifo(fifo);
 }
 
-static int push_task_eager_policy(struct starpu_task *task, struct starpu_sched_ctx *sched_ctx)
+static int push_task_eager_policy(struct starpu_task *task, int sched_ctx_id)
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	int i;
 	int workerid;
 	for(i = 0; i < sched_ctx->nworkers_in_ctx; i++){
@@ -68,7 +72,7 @@ static int push_task_eager_policy(struct starpu_task *task, struct starpu_sched_
 	return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
 }
 
-static int push_prio_task_eager_policy(struct starpu_task *task, struct starpu_sched_ctx *sched_ctx)
+static int push_prio_task_eager_policy(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
 {
 	return _starpu_fifo_push_prio_task(fifo, &sched_mutex, &sched_cond, task);
 }
@@ -85,7 +89,8 @@ static struct starpu_task *pop_task_eager_policy(void)
 
 	if(task)
 	  {
-		struct starpu_sched_ctx *sched_ctx = task->sched_ctx;
+	    struct starpu_sched_ctx *sched_ctx = NULL;
+		  _starpu_get_sched_ctx(task->sched_ctx);
 
 		int i;
 		for(i = 0; i <sched_ctx->nworkers_in_ctx; i++)

+ 5 - 3
src/sched_policies/eager_central_priority_policy.c

@@ -74,8 +74,10 @@ static void _starpu_destroy_priority_taskq(struct starpu_priority_taskq_s *prior
 	free(priority_queue);
 }
 
-static void initialize_eager_center_priority_policy(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_eager_center_priority_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	/* In this policy, we support more than two levels of priority. */
 	starpu_sched_set_min_priority(MIN_LEVEL);
 	starpu_sched_set_max_priority(MAX_LEVEL);
@@ -96,7 +98,7 @@ static void initialize_eager_center_priority_policy(struct starpu_sched_ctx *sch
 	}
 }
 
-static void deinitialize_eager_center_priority_policy(struct starpu_sched_ctx *sched_ctx) 
+static void deinitialize_eager_center_priority_policy(__attribute__ ((unused)) int sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -104,7 +106,7 @@ static void deinitialize_eager_center_priority_policy(struct starpu_sched_ctx *s
 	_starpu_destroy_priority_taskq(taskq);
 }
 
-static int _starpu_priority_push_task(struct starpu_task *task, struct starpu_sched_ctx *sched_ctx)
+static int _starpu_priority_push_task(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
 {
 	/* wake people waiting for a task */
 	PTHREAD_MUTEX_LOCK(&global_sched_mutex);

+ 1 - 1
src/sched_policies/heft.c

@@ -362,7 +362,7 @@ static void heft_deinit(int sched_ctx_id)
 	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
         unsigned workerid;
 	int workerid_in_ctx;
-	unsigned nworkers = sched_ctx->nworkers_in_ctx;
+	int nworkers = sched_ctx->nworkers_in_ctx;
 	for (workerid_in_ctx = 0; workerid_in_ctx < nworkers; workerid_in_ctx++){
 	        workerid = sched_ctx->workerid[workerid_in_ctx];
 		PTHREAD_MUTEX_DESTROY(&sched_mutex[workerid]);

+ 5 - 3
src/sched_policies/parallel_greedy.c

@@ -34,8 +34,10 @@ 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(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_pgreedy_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	/* masters pick tasks from that queue */
 	fifo = _starpu_create_fifo();
 
@@ -135,7 +137,7 @@ static void initialize_pgreedy_policy(struct starpu_sched_ctx *sched_ctx)
 #endif
 }
 
-static void deinitialize_pgreedy_policy(__attribute__ ((unused)) struct starpu_sched_ctx *sched_ctx) 
+static void deinitialize_pgreedy_policy(__attribute__ ((unused)) int sched_ctx_id) 
 {
 	/* TODO check that there is no task left in the queue */
 
@@ -143,7 +145,7 @@ static void deinitialize_pgreedy_policy(__attribute__ ((unused)) struct starpu_s
 	_starpu_destroy_fifo(fifo);
 }
 
-static int push_task_pgreedy_policy(struct starpu_task *task, __attribute__ ((unused)) struct starpu_sched_ctx *sched_ctx)
+static int push_task_pgreedy_policy(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
 {
 	return _starpu_fifo_push_task(fifo, &sched_mutex, &sched_cond, task);
 }

+ 14 - 9
src/sched_policies/parallel_heft.c

@@ -375,23 +375,26 @@ 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, struct starpu_sched_ctx *sched_ctx)
+static int parallel_heft_push_prio_task(struct starpu_task *task, int sched_ctx_id)
 {
-  return _parallel_heft_push_task(task, 1, sched_ctx);
+	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, struct starpu_sched_ctx *sched_ctx)
-{
-  printf("pheft: push task non null = %d into ctx non null = %d\n", task != NULL, sched_ctx != NULL);
+static int parallel_heft_push_task(struct starpu_task *task, int sched_ctx_id)
+{ 
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
 	if (task->priority == STARPU_MAX_PRIO)
 	  return _parallel_heft_push_task(task, 1, sched_ctx);
 
 	return _parallel_heft_push_task(task, 0, sched_ctx);
 }
 
-static void initialize_parallel_heft_policy(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_parallel_heft_policy(int sched_ctx_id) 
 {
-  printf("initialize parallel heft\n");
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	nworkers = sched_ctx->nworkers_in_ctx;
 	struct starpu_machine_config_s *config = _starpu_get_machine_config();
 	struct starpu_machine_topology_s *topology = &config->topology;
@@ -440,7 +443,7 @@ static void initialize_parallel_heft_policy(struct starpu_sched_ctx *sched_ctx)
 
 	for (workerid_ctx = 0; workerid_ctx < total_worker_count; workerid_ctx++)
 	{
-	  workerid = workerid_ctx >= nworkers ? (nworkers_machine + workerid_ctx - nworkers) : sched_ctx->workerid[workerid_ctx];
+	  workerid = (unsigned)workerid_ctx >= nworkers ? (nworkers_machine + (unsigned)workerid_ctx - nworkers) : sched_ctx->workerid[workerid_ctx];
 	  printf("workerid = %d\n", workerid);
 		enum starpu_perf_archtype perf_archtype = starpu_worker_get_perf_archtype(workerid);
 		printf("perf_archtype = %d\n", perf_archtype);
@@ -457,8 +460,10 @@ static void initialize_parallel_heft_policy(struct starpu_sched_ctx *sched_ctx)
 	}
 }
 
-static void deinitialize_parallel_heft_policy(struct starpu_sched_ctx *sched_ctx) 
+static void deinitialize_parallel_heft_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	unsigned workerid;
 	int workerid_in_ctx;
         int nworkers = sched_ctx->nworkers_in_ctx;

+ 10 - 4
src/sched_policies/random_policy.c

@@ -70,18 +70,24 @@ 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, struct starpu_sched_ctx *sched_ctx)
-{
+static int random_push_prio_task(struct starpu_task *task, int 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, struct starpu_sched_ctx *sched_ctx)
+static int random_push_task(struct starpu_task *task, int 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(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_random_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	starpu_srand48(time(NULL));
 
 	unsigned nworkers = sched_ctx->nworkers_in_ctx;	

+ 4 - 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, struct starpu_sched_ctx *sched_ctx)
+int ws_push_task(struct starpu_task *task, __attribute__ ((unused)) int sched_ctx_id)
 {
 	starpu_job_t j = _starpu_get_job_associated_to_task(task);
 
@@ -192,8 +192,10 @@ int ws_push_task(struct starpu_task *task, struct starpu_sched_ctx *sched_ctx)
         return 0;
 }
 
-static void initialize_ws_policy(struct starpu_sched_ctx *sched_ctx) 
+static void initialize_ws_policy(int sched_ctx_id) 
 {
+	struct starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx(sched_ctx_id);
+
 	nworkers = sched_ctx->nworkers_in_ctx;
 	rr_worker = 0;