Browse Source

improving the config and compilation process for multiple linear regression

Luka Stanisic 9 years ago
parent
commit
852bac2269
3 changed files with 26 additions and 20 deletions
  1. 17 11
      configure.ac
  2. 8 8
      src/core/perfmodel/multiple_regression.c
  3. 1 1
      src/core/perfmodel/multiple_regression.h

+ 17 - 11
configure.ac

@@ -1131,19 +1131,25 @@ fi
 #			 Multiple linear regression			      #
 #			 Multiple linear regression			      #
 #                                                                             #
 #                                                                             #
 ###############################################################################
 ###############################################################################
-AC_ARG_ENABLE(mlr_model, [AS_HELP_STRING([--enable-mlr-model],
-			[Enable multiple linear regression models])],
-			enable_mlr_model=$enableval, enable_mlr_model=no)
-if test x$enable_mlr_model = xyes ; then
-        MLR_MODEL_CFLAGS="-I/home/stanisic/Work/min-dgels/src/additional"			
-   	if test -n "$MLR_MODEL_CFLAGS" ; then
-	   	CFLAGS="$MLR_MODEL_CFLAGS $CFLAGS"
-	   	CXXFLAGS="$MLR_MODEL_CFLAGS $CXXFLAGS"
-	   	NVCCFLAGS="$MLR_MODEL_CFLAGS $NVCCFLAGS"
+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])
+	LDFLAGS="-llapack $LDFLAGS"
+	enable_dgels=yes
+elif test x"$DGELS_LIBS" != x; then
+        AC_DEFINE(MIN_DGELS, [1], [use user defined library])
+	LDFLAGS="$DGELS_LIBS $LDFLAGS"
+        AC_ARG_VAR([DGELS_LIBS], [linker flags for lapack dgels])
+	if test -n "$DGELS_CFLAGS" ; then
+	   	CFLAGS="$DGELS_CFLAGS $CFLAGS"
+	   	CXXFLAGS="$DGELS_CFLAGS $CXXFLAGS"
+	   	NVCCFLAGS="$DGELS_CFLAGS $NVCCFLAGS"
 	fi
 	fi
-	LDFLAGS="-Wl,--start-group /home/stanisic/Work/min-dgels/src/build/*.a -Wl,--end-group $LDFLAGS"	
+        enable_dgels=yes
+else
+	enable_dgels=no
 fi
 fi
-AM_CONDITIONAL(MLR_MODEL, test x$enable_mlr_model = xyes)
+AM_CONDITIONAL(DGELS, test x$enable_dgels = xyes)
 
 
 ###############################################################################
 ###############################################################################
 #                                                                             #
 #                                                                             #

+ 8 - 8
src/core/perfmodel/multiple_regression.c

@@ -26,9 +26,9 @@
 #endif //TESTGSL
 #endif //TESTGSL
 
 
 // From additional-lapack-func
 // From additional-lapack-func
-#ifdef MLR_MODEL
+#ifdef MIN_DGELS
 #include "mindgels.h"
 #include "mindgels.h"
-#endif //MLR_MODEL
+#endif //MIN_DGELS
 
 
 typedef struct { int h, w; double *x;} matrix_t, *matrix;
 typedef struct { int h, w; double *x;} matrix_t, *matrix;
 
 
@@ -138,7 +138,7 @@ void gsl_multiple_reg_coeff(double *mpar, double *my, long n, unsigned ncoeff, u
 }
 }
 #endif //TESTGSL
 #endif //TESTGSL
 
 
-#ifdef MLR_MODEL
+#ifdef DGELS
 void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
 void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff, unsigned nparameters, double *coeff, unsigned **combinations)
 {	
 {	
  /*  Arguments */
  /*  Arguments */
@@ -269,9 +269,9 @@ void dgels_multiple_reg_coeff(double *mpar, double *my, long nn, unsigned ncoeff
 	free(Y);
 	free(Y);
 	free(work);
 	free(work);
 }
 }
-#endif //MLR_MODEL
+#endif //DGELS
 
 
-int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, char *codelet_name)
+int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, double *coeff, unsigned ncoeff, unsigned nparameters, unsigned **combinations, const char *codelet_name)
 {
 {
 	// Computing number of rows
 	// Computing number of rows
 	long n=find_long_list_size(ptr);
 	long n=find_long_list_size(ptr);
@@ -311,9 +311,9 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
 #ifdef TESTGSL
 #ifdef TESTGSL
 	gsl_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
 	gsl_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
 #endif
 #endif
-#ifdef MLR_MODEL
+#ifdef DGELS
 	dgels_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
 	dgels_multiple_reg_coeff(mpar, my, n, ncoeff, nparameters, coeff, combinations);
-#endif //MLR_MODEL
+#endif //DGELS
 	
 	
 	// Preparing new output calibration file
 	// Preparing new output calibration file
 	if (calibrate==2)
 	if (calibrate==2)
@@ -328,7 +328,7 @@ int _starpu_multiple_regression(struct starpu_perfmodel_history_list *ptr, doubl
 	}
 	}
 	
 	
 	// Writing parameters to calibration file
 	// Writing parameters to calibration file
-	if (calibrate>0)
+	if (calibrate==1 || calibrate==2)
 	{
 	{
 		for(int i=old_lines; i<n; i++)
 		for(int i=old_lines; i<n; i++)
 		{
 		{

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

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