Quellcode durchsuchen

perf_model: make sure combination is always created (before it was created only when the perfmodel was dumped on file)

Nathalie Furmento vor 10 Jahren
Ursprung
Commit
53f712b7e9

+ 1 - 0
src/core/perfmodel/perfmodel.h

@@ -83,6 +83,7 @@ double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfm
 					struct starpu_perfmodel_arch* arch, struct _starpu_job *j, unsigned nimpl);
 void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch * arch,
 				unsigned cpuid, double measured, unsigned nimpl);
+void _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch);
 
 void _starpu_create_sampling_directory_if_needed(void);
 

+ 9 - 4
src/core/perfmodel/perfmodel_history.c

@@ -1245,16 +1245,21 @@ double starpu_permodel_history_based_expected_perf(struct starpu_perfmodel *mode
 	return _starpu_history_based_job_expected_perf(model, arch, &j, j.nimpl);
 }
 
+void _starpu_perfmodel_create_comb_if_needed(struct starpu_perfmodel_arch* arch)
+{
+	int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
+	if(comb == -1)
+		comb = starpu_perfmodel_arch_comb_add(arch->ndevices, arch->devices);
+}
+
 void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, unsigned cpuid STARPU_ATTRIBUTE_UNUSED, double measured, unsigned impl)
 {
 	if (model)
 	{
-		int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
-		if(comb == -1)
-			comb = starpu_perfmodel_arch_comb_add(arch->ndevices, arch->devices);
-
 		int c;
 		unsigned found = 0;
+		int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
+		STARPU_ASSERT(comb != -1);
 		for(c = 0; c < model->state->ncombs; c++)
 		{
 			if(model->state->combs[c] == comb)

+ 3 - 0
src/drivers/driver_common/driver_common.c

@@ -120,6 +120,7 @@ void _starpu_driver_end_job(struct _starpu_worker *worker, struct _starpu_job *j
 	if(!sched_ctx)
 		sched_ctx = _starpu_get_sched_ctx_struct(j->task->sched_ctx);
 
+	_starpu_perfmodel_create_comb_if_needed(perf_arch);
 	if (!sched_ctx->sched_policy)
 	{
 		if(sched_ctx->main_master == worker->workerid)
@@ -177,6 +178,8 @@ void _starpu_driver_update_job_feedback(struct _starpu_job *j, struct _starpu_wo
 	int calibrate_model = 0;
 	int updated = 0;
 
+	_starpu_perfmodel_create_comb_if_needed(perf_arch);
+
 #ifndef STARPU_SIMGRID
 	if (cl->model && cl->model->benchmarking)
 		calibrate_model = 1;