Sfoglia il codice sorgente

fixes for valid model

Andra Hugo 11 anni fa
parent
commit
a0f55874a4
2 ha cambiato i file con 16 aggiunte e 5 eliminazioni
  1. 3 1
      src/core/perfmodel/perfmodel_history.c
  2. 13 4
      tests/perfmodels/valid_model.c

+ 3 - 1
src/core/perfmodel/perfmodel_history.c

@@ -971,7 +971,7 @@ int starpu_perfmodel_load_symbol(const char *symbol, struct starpu_perfmodel *mo
 
 	FILE *f = fopen(path, "r");
 	STARPU_ASSERT(f);
-
+	starpu_perfmodel_init(NULL, model);
 	parse_model_file(f, model, 1);
 
 	STARPU_ASSERT(fclose(f) == 0);
@@ -1277,6 +1277,8 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 		{
 			struct starpu_perfmodel_regression_model *reg_model;
 			reg_model = &per_arch_model->regression;
+			if(reg_model->nsample == 0)
+				model->nimpls[comb]++;
 
 			/* update the regression model */
 			size_t job_size = _starpu_job_get_data_size(model, arch, impl, j);

+ 13 - 4
tests/perfmodels/valid_model.c

@@ -77,11 +77,15 @@ static int submit(struct starpu_codelet *codelet, struct starpu_perfmodel *model
 	lmodel.is_init=0;
 	lmodel.type = model->type;
 	ret = starpu_perfmodel_load_symbol(codelet->model->symbol, &lmodel);
-	int narch_combs = starpu_get_narch_combs();
-	int comb;
+	int narch_combs = lmodel.ncombs;
+	int comb, impl;
 	if (ret != 1)
 		for(comb = 0; comb < narch_combs; comb++)
-			old_nsamples += lmodel.per_arch[comb][0].regression.nsample;
+		{
+			int nimpls = lmodel.nimpls[lmodel.combs[comb]];
+			for(impl = 0; impl < nimpls; impl++)
+				old_nsamples += lmodel.per_arch[lmodel.combs[comb]][impl].regression.nsample;
+		}
 
         starpu_vector_data_register(&handle, -1, (uintptr_t)NULL, 100, sizeof(int));
 	for (loop = 0; loop < nloops; loop++)
@@ -105,9 +109,14 @@ static int submit(struct starpu_codelet *codelet, struct starpu_perfmodel *model
 		return 1;
 	}
 
+	narch_combs = lmodel.ncombs;
 	new_nsamples = 0;
 	for(comb = 0; comb < narch_combs; comb++)
-		new_nsamples += lmodel.per_arch[comb][0].regression.nsample;
+	{
+		int nimpls = lmodel.nimpls[lmodel.combs[comb]];
+		for(impl = 0; impl < nimpls; impl++)
+			new_nsamples += lmodel.per_arch[lmodel.combs[comb]][impl].regression.nsample;
+	}
 
 	ret = starpu_perfmodel_unload_model(&lmodel);
 	starpu_shutdown();