Browse Source

Use the context's perfmodel_arch when in a context without policy

Terry Cojean 10 years ago
parent
commit
5f499f5ec9
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/drivers/cpu/driver_cpu.c

+ 6 - 1
src/drivers/cpu/driver_cpu.c

@@ -263,7 +263,12 @@ int _starpu_cpu_driver_run_once(struct _starpu_worker *cpu_worker)
 		cpu_worker->combined_workerid = cpu_worker->workerid;
 		cpu_worker->worker_size = 1;
 		cpu_worker->current_rank = 0;
-		perf_arch = &cpu_worker->perf_arch;
+
+		struct _starpu_sched_ctx *sched_ctx = _starpu_sched_ctx_get_sched_ctx_for_worker_and_job(cpu_worker, j);
+		if (!sched_ctx->sched_policy && !sched_ctx->awake_workers && sched_ctx->main_master == cpu_worker->workerid)
+			perf_arch = &sched_ctx->perf_arch;
+		else
+			perf_arch = &cpu_worker->perf_arch;
 	}
 
 	_starpu_set_current_task(j->task);