Ver código fonte

working on perfmodels

Luka Stanisic 9 anos atrás
pai
commit
4237897749
2 arquivos alterados com 25 adições e 2 exclusões
  1. 5 0
      include/starpu_perfmodel.h
  2. 20 2
      src/core/perfmodel/perfmodel.c

+ 5 - 0
include/starpu_perfmodel.h

@@ -138,6 +138,11 @@ struct starpu_perfmodel
 	unsigned benchmarking;
 	unsigned is_init;
 
+	double *parameters;
+	unsigned nparameters;
+	unsigned **combinations;
+	unsigned ncombinations;
+
 	starpu_perfmodel_state_t state;
 };
 

+ 20 - 2
src/core/perfmodel/perfmodel.c

@@ -136,8 +136,26 @@ static double common_task_expected_perf(struct starpu_perfmodel *model, struct s
 
 static double starpu_mymodel_expected_perf(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, struct starpu_task *task, unsigned nimpl)
 {
-	STARPU_ASSERT_MSG(model->cost_function, "STARPU_MYMODEL requires mymodel cost_function to be defined");
-	return model->cost_function(task, nimpl);
+    //double coefficients[model->ncombinations+1]
+	double coefficients[4] ={
+           0.664437*1000, //intercept
+		   3.2, //M
+		   4.1, //N
+           4.4 //MN^2
+       };
+	double expected_duration=coefficients[0];
+	double parameter_value;
+
+	//duration= a+b*M^1*N^0+c*M^0*N^1+d*M^1*N^2
+	for (int i=0; i < model->ncombinations; i++){
+		parameter_value=1.;
+		for (int j=0; j < model->nparameters; j++)
+			parameter_value *= model->parameters[j]*model->combinations[i][j];
+
+		expected_duration += coefficients[i+1]*parameter_value;
+	}
+
+	return expected_duration;
 }
 
 void _starpu_init_and_load_perfmodel(struct starpu_perfmodel *model)