瀏覽代碼

Add support for the MKL. Since it is really hard to guess the flags for MKL, we
let the user explicitly specify the compilation and linking flags at configure
time.

NB: The http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
webpage provides a script to automatically detect which flags to use.

Cédric Augonnet 14 年之前
父節點
當前提交
9817b32691
共有 4 個文件被更改,包括 23 次插入3 次删除
  1. 20 1
      configure.ac
  2. 1 1
      examples/common/blas.c
  3. 1 1
      examples/common/blas.h
  4. 1 0
      include/starpu_config.h.in

+ 20 - 1
configure.ac

@@ -817,7 +817,25 @@ AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
 fi
 
 fi
- 
+
+if test x$blas_lib = xmaybe; then
+	# Should we use MKL ?
+	AC_ARG_WITH(mkl-cflags, [AS_HELP_STRING([--with-mkl-cflags], [specify MKL compilation flags])],
+		[
+			CPPFLAGS="${CPPFLAGS} $withval"
+			blas_lib=mkl
+		])
+
+	AC_ARG_WITH(mkl-ldflags, [AS_HELP_STRING([--with-mkl-ldflags], [specify MKL linking flags])],
+		[
+			LDFLAGS="${LDFLAGS} $withval"
+			blas_lib=mkl
+		])
+	if test x$blas_lib=xmkl; then
+	        AC_DEFINE(STARPU_MKL, [1], [use MKL library])
+	fi
+fi
+
 if test x$blas_lib = xmaybe; then
      #perhaps it is possible to use some BLAS lib from the system
      use_system_blas=no
@@ -832,6 +850,7 @@ fi
 
 AM_CONDITIONAL(ATLAS_BLAS_LIB, test x$blas_lib = xatlas)
 AM_CONDITIONAL(GOTO_BLAS_LIB, test x$blas_lib = xgoto)
+AM_CONDITIONAL(MKL_BLAS_LIB, test x$blas_lib = xmkl)
 AM_CONDITIONAL(SYSTEM_BLAS_LIB, test x$blas_lib = xsystem)
 AM_CONDITIONAL(NO_BLAS_LIB, test x$blas_lib = xnone)
 

+ 1 - 1
examples/common/blas.c

@@ -232,7 +232,7 @@ void DSWAP(const int n, double *x, const int incx, double *y, const int incy)
 	cblas_dswap(n, x, incx, y, incy);
 }
 
-#elif defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS)
+#elif defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL)
 
 inline void SGEMM(char *transa, char *transb, int M, int N, int K, 
 			float alpha, float *A, int lda, float *B, int ldb, 

+ 1 - 1
examples/common/blas.h

@@ -76,7 +76,7 @@ float SDOT(const int n, const float *x, const int incx, const float *y, const in
 void SSWAP(const int n, float *x, const int incx, float *y, const int incy);
 void DSWAP(const int n, double *x, const int incx, double *y, const int incy);
 
-#if defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS)
+#if defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL)
 
 extern void sgemm_ (const char *transa, const char *transb, const int *m,
                    const int *n, const int *k, const float *alpha, 

+ 1 - 0
include/starpu_config.h.in

@@ -10,6 +10,7 @@
 
 #undef STARPU_ATLAS
 #undef STARPU_GOTO
+#undef STARPU_MKL
 #undef STARPU_SYSTEM_BLAS
 
 #undef STARPU_BUILD_DIR