Parcourir la source

Management of sched_ctxs for workers

Andra Hugo il y a 14 ans
Parent
commit
46d88302f8
3 fichiers modifiés avec 13 ajouts et 1 suppressions
  1. 1 0
      src/core/topology.c
  2. 1 1
      src/core/workers.h
  3. 11 0
      src/drivers/cpu/driver_cpu.c

+ 1 - 0
src/core/topology.c

@@ -462,6 +462,7 @@ static int _starpu_init_machine_config(struct starpu_machine_config_s *config,
 		config->workers[topology->nworkers + cpu].devid = cpu;
 		config->workers[topology->nworkers + cpu].worker_mask = STARPU_CPU;
 		config->worker_mask |= STARPU_CPU;
+		config->workers[topology->nworkers + cpu].sched_ctx = (struct starpu_sched_ctx**)malloc(sizeof(struct starpu_sched_ctx*));
 	}
 
 	topology->nworkers += topology->ncpus;

+ 1 - 1
src/core/workers.h

@@ -78,7 +78,7 @@ struct starpu_worker_s {
 	starpu_worker_status status; /* what is the worker doing now ? (eg. CALLBACK) */
 	char name[32];
 
-	struct starpu_sched_ctx *sched_ctx[STARPU_NMAX_SCHED_CTXS];
+	struct starpu_sched_ctx **sched_ctx;
 	unsigned nctxs; /* the no of contexts a worker belongs to*/
 	unsigned changing_ctx;
 	pthread_mutex_t changing_ctx_mutex;

+ 11 - 0
src/drivers/cpu/driver_cpu.c

@@ -177,6 +177,17 @@ void *_starpu_cpu_worker(void *arg)
 		{
 			PTHREAD_MUTEX_LOCK(sched_mutex);
 			if (_starpu_worker_can_block(memnode))
+/* 			struct starpu_sched_ctx **sched_ctx = cpu_arg->sched_ctx; */
+/* 			int i = 0; */
+/* 			int sleep = 0; */
+/* 			for(i = 0; i < cpu_arg->nctxs; i++){ */
+/* 			  if(sched_ctx[i]->sched_ctx_id  == 2 ){ */
+/* 			    sleep = 1; */
+/* 			    break; */
+/* 			  } */
+/* 			} */
+
+/* 			if(sleep) */
 				_starpu_block_worker(workerid, sched_cond, sched_mutex);
 
 			PTHREAD_MUTEX_UNLOCK(sched_mutex);