Selaa lähdekoodia

mlr: allowing parameters to have no names

Luka Stanisic 9 vuotta sitten
vanhempi
commit
82efa743b9

+ 7 - 2
src/core/perfmodel/multiple_regression.c

@@ -254,7 +254,7 @@ void validate(double *coeff, unsigned ncoeff)
 			_STARPU_DISP("Warning: Coefficient computed by least square method is extremelly small (%f). The model is likely to be inaccurate.\n", coeff[i]);
 }
 	
-int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, const char *codelet_name)
+int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, const char **parameters_names, unsigned **combinations, const char *codelet_name)
 {
         long i;
 	unsigned j;
@@ -331,7 +331,12 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
 			STARPU_ASSERT_MSG(f, "Could not save performance model into the file %s\n", filepath);
 			fprintf(f, "Duration");
 			for(j=0; j<nparameters; j++)
-				fprintf(f, ", P%d", j);
+			{
+				if(parameters_names != NULL && parameters_names[j]!= NULL)
+					fprintf(f, ", %s", parameters_names[j]);
+				else
+					fprintf(f, ", P%d", j);
+			}
 		}
 	}
 	

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

@@ -24,6 +24,6 @@
 #include <core/perfmodel/perfmodel.h>
 #include <starpu.h>
 
-int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, const char *codelet_name);
+int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, const char **parameters_names, unsigned **combinations, const char *codelet_name);
 
 #endif // __MULTIPLE_REGRESSION_H__

+ 7 - 2
src/core/perfmodel/perfmodel_history.c

@@ -296,7 +296,7 @@ static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, in
 			reg_model->ncoeff = model->ncombinations + 1;
 
 		reg_model->coeff = (double *) malloc(reg_model->ncoeff*sizeof(double));
-		_starpu_multiple_regression(per_arch_model->list, reg_model->coeff, reg_model->ncoeff, model->nparameters, model->combinations, model->symbol);
+		_starpu_multiple_regression(per_arch_model->list, reg_model->coeff, reg_model->ncoeff, model->nparameters, model->parameters_names, model->combinations, model->symbol);
 
 		fprintf(f, "# n\tintercept\t");
 	        unsigned i, j;
@@ -316,7 +316,12 @@ static void dump_reg_model(FILE *f, struct starpu_perfmodel *model, int comb, in
 							first=0;
 						else
 							fprintf(f, "*");
-						fprintf(f, "%s", model->parameters_names[j]);
+						
+						if(model->parameters_names[j]!= NULL)
+							fprintf(f, "%s", model->parameters_names[j]);
+						else
+							fprintf(f, "P%d", j);
+						
 						if (model->combinations[i][j] > 1)
 							fprintf(f, "^%d", model->combinations[i][j]);
 					}