Преглед на файлове

mlr: if there is no lapack install and always use min-dgels

Luka Stanisic преди 8 години
родител
ревизия
bc1d3ecf4e
променени са 2 файла, в които са добавени 14 реда и са изтрити 62 реда
  1. 13 7
      configure.ac
  2. 1 55
      src/core/perfmodel/multiple_regression.c

+ 13 - 7
configure.ac

@@ -1134,19 +1134,25 @@ fi
 STARPU_SEARCH_LIBS(LAPACK,[dgels_],[lapack],use_system_lapack=yes,,)
 if test x$use_system_lapack = xyes; then
         AC_DEFINE(STARPU_SYSTEM_LAPACK, [1], [use reflapack library])
-        AC_DEFINE(DGELS, [1], [enable DGELS])
 	LDFLAGS="-llapack $LDFLAGS"
-	enable_dgels=yes
 elif test x"$DGELS_LIBS" != x; then
-        AC_DEFINE(MIN_DGELS, [1], [use user defined library])
-        AC_DEFINE(DGELS, [1], [enable DGELS])
+        AC_DEFINE(STARPU_MIN_DGELS, [1], [use user defined library])
 	LDFLAGS="$DGELS_LIBS $LDFLAGS"
         AC_ARG_VAR([DGELS_LIBS], [linker flags for lapack dgels])
-        enable_dgels=yes
 else
-	enable_dgels=no
+	AC_MSG_ERROR([Need to install LAPACK or min-dgels library])
+	# wget https://github.com/stanisic/min-dgels/raw/master/min-dgels-src.tar.gz
+	# mkdir -p min-dgels
+	# tar xvzf min-dgels-src.tar.gz -C min-dgels
+	# cd min-dgels/src
+	# make
+	# cd ../..
+	# export DGELS_LIBS="-Wl,--start-group $PWD/min-dgels/src/build/*.a -Wl,--end-group"
+	# AC_DEFINE(STARPU_MIN_DGELS, [1], [use user defined library])
+	# LDFLAGS="$DGELS_LIBS $LDFLAGS"
+        # AC_ARG_VAR([DGELS_LIBS], [linker flags for lapack dgels])
 fi
-AM_CONDITIONAL(DGELS, test x$enable_dgels = xyes)
+
 
 ###############################################################################
 #                                                                             #

+ 1 - 55
src/core/perfmodel/multiple_regression.c

@@ -19,18 +19,11 @@
 
 #include <core/perfmodel/multiple_regression.h>
 
-#ifdef TESTGSL
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_math.h>
-#include <gsl/gsl_multifit.h>
-#endif //TESTGSL
-
-#ifdef DGELS
 typedef long int integer;
 typedef double doublereal;
 
 int dgels_(char *trans, integer *m, integer *n, integer *nrhs, doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *work, integer *lwork, integer *info);
-#endif //DGELS
+
 
 static long count_file_lines(FILE *f)
 {
@@ -100,45 +93,6 @@ static long find_long_list_size(struct starpu_perfmodel_history_list *list_histo
 	return cnt;
 }
 
-#ifdef TESTGSL
-void gsl_multiple_reg_coeff(double *mpar, double *my, long n, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
-{
-	double coefficient;
-	gsl_matrix *X = gsl_matrix_calloc(n, ncoeff);
-	gsl_vector *Y = gsl_vector_alloc(n);
-	gsl_vector *beta = gsl_vector_alloc(ncoeff);
-
-	for (int i = 0; i < n; i++) {
-		gsl_vector_set(Y, i, my[i]);
-		gsl_matrix_set(X, i, 0, 1.);
-		for (int j = 1; j < ncoeff; j++)
-		{
-			coefficient = 1.;
-			for(int k=0; k < nparameters; k++)
-			{
-				coefficient *= pow(mpar[i*nparameters+k],combinations[j-1][k]);
-			}
-			gsl_matrix_set(X, i, j, coefficient);
-		}
-	}
-
-	double chisq;
-	gsl_matrix *cov = gsl_matrix_alloc(ncoeff, ncoeff);
-	gsl_multifit_linear_workspace * wspc = gsl_multifit_linear_alloc(n, ncoeff);
-	gsl_multifit_linear(X, Y, beta, cov, &chisq, wspc);
-
-	for(int i=0; i<ncoeff; i++)
-		coeff[i] = gsl_vector_get(beta, i);
-
-	gsl_matrix_free(X);
-	gsl_matrix_free(cov);
-	gsl_vector_free(Y);
-	gsl_vector_free(beta);
-	gsl_multifit_linear_free(wspc);
-}
-#endif //TESTGSL
-
-#ifdef DGELS
 int dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
 {	
  /*  Arguments */
@@ -272,8 +226,6 @@ int dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff,
 
 	return 0;
 }
-#endif //DGELS
-
 
 /*
    Validating the accuracy of the coefficients.
@@ -332,14 +284,8 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
 	dump_multiple_regression_list(mpar, my, old_lines, nparameters, ptr);
 	
 	/* Computing coefficients using multiple linear regression */
-#ifdef DGELS
 	if(dgels_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations))
 		return 1;
-#elif TESTGSL
-	gsl_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);	
-#else
-	return 1;
-#endif
 
 	/* Basic validation of the model accuracy */
 	validate(coeff, ncoeff);