Pārlūkot izejas kodu

add support for ARM performance libraries

Olivier Aumage 6 gadi atpakaļ
vecāks
revīzija
1202a7885a
4 mainītis faili ar 40 papildinājumiem un 5 dzēšanām
  1. 34 0
      configure.ac
  2. 2 2
      examples/common/blas.c
  3. 3 3
      examples/common/blas.h
  4. 1 0
      include/starpu_config.h.in

+ 34 - 0
configure.ac

@@ -2960,6 +2960,8 @@ AC_ARG_ENABLE(blas-lib,
         blas_lib=none
      elif test "x$enableval" = "xmkl" ; then
         blas_lib=mkl
+     elif test "x$enableval" = "xarmpl" ; then
+        blas_lib=armpl
      elif test x$enableval = xno; then
 	blas_lib=none
      else
@@ -3077,6 +3079,38 @@ if test x$blas_lib = xmaybe -o x$blas_lib = xmkl; then
     fi
 fi
 
+if test x$blas_lib = xmaybe -o x$blas_lib = xarmpl; then
+    # Should we use ARMPL ?
+    if test -n "$ARMPL_DIR" ; then
+        CPPFLAGS="${CPPFLAGS} -I$ARMPL_INCLUDES"
+	SAVED_LIBS=$LIBS
+	STARPU_BLAS_LDFLAGS="-L$ARMPL_LIBRARIES -larmpl_lp64 -lgfortran -lm"
+	LIBS="$LIBS $STARPU_BLAS_LDFLAGS"
+	AC_LINK_IFELSE(
+		[AC_LANG_PROGRAM([[
+			#include <armpl.h>
+		]], [[ ]])],
+		[ blas_lib=armpl ],
+		[ STARPU_BLAS_LDFLAGS="" ],
+	)
+	LIBS=$SAVED_LIBS
+    fi
+    AC_ARG_WITH(armpl-cflags, [AS_HELP_STRING([--with-armpl-cflags], [specify ARMPL compilation flags])],
+	[
+        CPPFLAGS="${CPPFLAGS} $withval"
+	blas_lib=armpl
+	])
+
+    AC_ARG_WITH(armpl-ldflags, [AS_HELP_STRING([--with-armpl-ldflags], [specify ARMPL linking flags])],
+	[
+	STARPU_BLAS_LDFLAGS="$withval"
+	blas_lib=armpl
+	])
+    if test x$blas_lib = xarmpl; then
+	AC_DEFINE(STARPU_ARMPL, [1], [use ARMPL 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

+ 2 - 2
examples/common/blas.c

@@ -239,7 +239,7 @@ void STARPU_DSWAP(const int n, double *x, const int incx, double *y, const int i
 	cblas_dswap(n, x, incx, y, incy);
 }
 
-#elif defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL)
+#elif defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL) || defined(STARPU_ARMPL)
 
 inline void STARPU_SGEMM(char *transa, char *transb, int M, int N, int K, 
 			float alpha, const float *A, int lda, const float *B, int ldb, 
@@ -415,7 +415,7 @@ void STARPU_DSWAP(const int n, double *X, const int incX, double *Y, const int i
 	dswap_(&n, X, &incX, Y, &incY);
 }
 
-#ifdef STARPU_MKL
+#if defined(STARPU_MKL) || defined(STARPU_ARMPL)
 void STARPU_SPOTRF(const char*uplo, const int n, float *a, const int lda)
 {
 	int info = 0;

+ 3 - 3
examples/common/blas.h

@@ -83,12 +83,12 @@ double STARPU_DDOT(const int n, const double *x, const int incx, const double *y
 void STARPU_SSWAP(const int n, float *x, const int incx, float *y, const int incy);
 void STARPU_DSWAP(const int n, double *x, const int incx, double *y, const int incy);
 
-#ifdef STARPU_MKL
+#if defined(STARPU_MKL) || defined(STARPU_ARMPL)
 void STARPU_SPOTRF(const char*uplo, const int n, float *a, const int lda);
 void STARPU_DPOTRF(const char*uplo, const int n, double *a, const int lda);
 #endif
 
-#if defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL)
+#if defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL) || defined(STARPU_ARMPL)
 
 extern void sgemm_ (const char *transa, const char *transb, const int *m,
                    const int *n, const int *k, const float *alpha, 
@@ -158,7 +158,7 @@ extern double ddot_(const int *n, const double *x, const int *incx, const double
 extern void sswap_(const int *n, float *x, const int *incx, float *y, const int *incy);
 extern void dswap_(const int *n, double *x, const int *incx, double *y, const int *incy);
 
-#ifdef STARPU_MKL
+#if (defined STARPU_MKL) || (defined STARPU_ARMPL)
 extern void spotrf_(const char*uplo, const int *n, float *a, const int *lda, int *info);
 extern void dpotrf_(const char*uplo, const int *n, double *a, const int *lda, int *info);
 #endif

+ 1 - 0
include/starpu_config.h.in

@@ -63,6 +63,7 @@
 #undef STARPU_GOTO
 #undef STARPU_OPENBLAS
 #undef STARPU_MKL
+#undef STARPU_ARMPL
 #undef STARPU_SYSTEM_BLAS
 
 #undef STARPU_OPENCL_DATADIR