Просмотр исходного кода

Add option to link against gotoblas

Samuel Thibault лет назад: 7
Родитель
Сommit
a1670d8924

+ 22 - 0
configure.ac

@@ -2937,6 +2937,8 @@ AC_ARG_ENABLE(blas-lib,
         blas_lib=atlas
      elif test "x$enableval" = "xgoto" ; then
         blas_lib=goto
+     elif test "x$enableval" = "xopenblas" ; then
+        blas_lib=openblas
      elif test "x$enableval" = "xnone" ; then
         blas_lib=none
      elif test "x$enableval" = "xmkl" ; then
@@ -2998,6 +3000,26 @@ if test x$blas_lib = xmaybe -o x$blas_lib = xatlas; then
     fi
 fi
 
+if test x$blas_lib = xmaybe -o x$blas_lib = xopenblas; then
+    PKG_CHECK_MODULES([OPENBLAS],  [openblas],  [
+      PKG_CHECK_MODULES([BLAS_OPENBLAS],  [blas-openblas],  [
+        AC_DEFINE([STARPU_OPENBLAS], [1], [Define to 1 if you use the openblas library.])
+        AC_SUBST([STARPU_OPENBLAS], [1])
+        CFLAGS="${CFLAGS} ${OPENBLAS_CFLAGS} ${BLAS_OPENBLAS_CFLAGS} "
+        LIBS="${LIBS} ${OPENBLAS_LIBS} ${BLAS_OPENBLAS_LIBS} "
+        blas_lib=openblas
+      ], [
+	if text x$blas_lib = xopenblas; then
+	  AC_MSG_ERROR([cannot find blas-openblas lib])
+	fi
+      ])
+    ], [
+      if text x$blas_lib = xopenblas; then
+        AC_MSG_ERROR([cannot find openblas lib])
+      fi
+    ])
+fi
+
 if test x$blas_lib = xmaybe -o x$blas_lib = xmkl; then
     # Should we use MKL ?
     if test -n "$MKLROOT"

+ 2 - 1
doc/doxygen/chapters/510_configure_options.doxy

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011-2013,2015-2017                      Inria
  * Copyright (C) 2010-2017                                CNRS
- * Copyright (C) 2009-2011,2013-2017                      Université de Bordeaux
+ * Copyright (C) 2009-2011,2013-2018                      Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -540,6 +540,7 @@ Specify the blas library to be used by some of the examples. Librairies availabl
 - none [default] : no BLAS library is used
 - atlas: use ATLAS library
 - goto: use GotoBLAS library
+- openblas: use OpenBLAS library
 - mkl: use MKL library (you may need to set specific CFLAGS and LDFLAGS with --with-mkl-cflags and --with-mkl-ldflags)
 </dd>
 

+ 2 - 2
examples/common/blas.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2009-2011,2014-2015                      Université de Bordeaux
+ * Copyright (C) 2009-2011,2014-2015, 2018                Université de Bordeaux
  * Copyright (C) 2010,2015,2017                           CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -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_SYSTEM_BLAS) || defined(STARPU_MKL)
+#elif defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || defined(STARPU_SYSTEM_BLAS) || defined(STARPU_MKL)
 
 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, 

+ 2 - 2
examples/common/blas.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2009-2011,2014                           Université de Bordeaux
+ * Copyright (C) 2009-2011,2014, 2018                     Université de Bordeaux
  * Copyright (C) 2010,2015,2017                           CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@ 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_SYSTEM_BLAS) || defined(STARPU_MKL)
+#if defined(STARPU_GOTO) || defined(STARPU_OPENBLAS) || 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, 

+ 5 - 1
examples/common/blas_model.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2008-2012,2014                           Université de Bordeaux
+ * Copyright (C) 2008-2012,2014, 2018                     Université de Bordeaux
  * Copyright (C) 2010-2012,2015,2017                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -29,6 +29,8 @@ static struct starpu_perfmodel starpu_sgemm_model =
 	.symbol = "sgemm_atlas"
 #elif defined(STARPU_GOTO)
 	.symbol = "sgemm_goto"
+#elif defined(STARPU_OPENBLAS)
+	.symbol = "sgemm_openblas"
 #else
 	.symbol = "sgemm"
 #endif
@@ -47,6 +49,8 @@ static struct starpu_perfmodel starpu_dgemm_model =
 	.symbol = "dgemm_atlas"
 #elif defined(STARPU_GOTO)
 	.symbol = "dgemm_goto"
+#elif defined(STARPU_OPENBLAS)
+	.symbol = "dgemm_openblas"
 #else
 	.symbol = "dgemm"
 #endif

+ 6 - 1
examples/heat/dw_factolu.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012-2013                                Inria
- * Copyright (C) 2008-2015,2017                           Université de Bordeaux
+ * Copyright (C) 2008-2015,2017-2018                      Université de Bordeaux
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010-2013,2015-2017                      CNRS
  *
@@ -766,6 +766,11 @@ void initialize_system(float **A, float **B, unsigned dim, unsigned pinned)
 	char * symbol_12 = "lu_model_12_goto";
 	char * symbol_21 = "lu_model_21_goto";
 	char * symbol_22 = "lu_model_22_goto";
+#elif defined(STARPU_OPENBLAS)
+	char * symbol_11 = "lu_model_11_openblas";
+	char * symbol_12 = "lu_model_12_openblas";
+	char * symbol_21 = "lu_model_21_openblas";
+	char * symbol_22 = "lu_model_22_openblas";
 #else
 	char * symbol_11 = "lu_model_11";
 	char * symbol_12 = "lu_model_12";

+ 2 - 2
examples/lu/blas_complex.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011                                     Inria
  * Copyright (C) 2010,2012,2015,2017                      CNRS
- * Copyright (C) 2009-2010,2014                           Université de Bordeaux
+ * Copyright (C) 2009-2010,2014, 2018                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -33,7 +33,7 @@
 #error not implemented
 #elif defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS)
 #error not implemented
-#elif defined(STARPU_MKL)
+#elif defined(STARPU_OPENBLAS) || defined(STARPU_MKL)
 
 inline void CGEMM(char *transa, char *transb, int M, int N, int K, 
 			complex float alpha, complex float *A, int lda, complex float *B, int ldb, 

+ 2 - 2
examples/lu/blas_complex.h

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2011                                     Inria
  * Copyright (C) 2010,2012,2015,2017                      CNRS
- * Copyright (C) 2009-2011,2014                           Université de Bordeaux
+ * Copyright (C) 2009-2011,2014, 2018                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -82,7 +82,7 @@ void ZSWAP(const int n, complex double *x, const int incx, complex double *y, co
 
 #if defined(STARPU_GOTO) || defined(STARPU_SYSTEM_BLAS)
 #error not implemented
-#elif defined(STARPU_MKL)
+#elif defined(STARPU_OPENBLAS) || defined(STARPU_MKL)
 
 extern void cgemm_ (const char *transa, const char *transb, const int *m,
                    const int *n, const int *k, const complex float *alpha, 

+ 13 - 1
examples/lu/xlu_kernels.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012                                Inria
- * Copyright (C) 2009-2017                                Université de Bordeaux
+ * Copyright (C) 2009-2018                                Université de Bordeaux
  * Copyright (C) 2010-2012,2015,2017                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -107,6 +107,8 @@ static struct starpu_perfmodel STARPU_LU(model_22) =
 	.symbol = STARPU_LU_STR(lu_model_22_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_22_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_22_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_22)
 #endif
@@ -228,6 +230,8 @@ static struct starpu_perfmodel STARPU_LU(model_12) =
 	.symbol = STARPU_LU_STR(lu_model_12_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_12_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_12_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_12)
 #endif
@@ -315,6 +319,8 @@ static struct starpu_perfmodel STARPU_LU(model_21) =
 	.symbol = STARPU_LU_STR(lu_model_21_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_21_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_21_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_21)
 #endif
@@ -433,6 +439,8 @@ static struct starpu_perfmodel STARPU_LU(model_11) =
 	.symbol = STARPU_LU_STR(lu_model_11_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_11_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_11_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_11)
 #endif
@@ -602,6 +610,8 @@ static struct starpu_perfmodel STARPU_LU(model_11_pivot) =
 	.symbol = STARPU_LU_STR(lu_model_11_pivot_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_11_pivot_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_11_pivot_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_11_pivot)
 #endif
@@ -703,6 +713,8 @@ static struct starpu_perfmodel STARPU_LU(model_pivot) =
 	.symbol = STARPU_LU_STR(lu_model_pivot_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_LU_STR(lu_model_pivot_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_LU_STR(lu_model_pivot_openblas)
 #else
 	.symbol = STARPU_LU_STR(lu_model_pivot)
 #endif

+ 2 - 1
include/starpu_config.h.in

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2012,2014,2016-2017                 Inria
- * Copyright (C) 2009-2017                                Université de Bordeaux
+ * Copyright (C) 2009-2018                                Université de Bordeaux
  * Copyright (C) 2010-2017                                CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -61,6 +61,7 @@
 
 #undef STARPU_ATLAS
 #undef STARPU_GOTO
+#undef STARPU_OPENBLAS
 #undef STARPU_MKL
 #undef STARPU_SYSTEM_BLAS
 

+ 9 - 1
mpi/examples/mpi_lu/pxlu_kernels.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2010-2015                                Université de Bordeaux
+ * Copyright (C) 2010-2015, 2018                          Université de Bordeaux
  * Copyright (C) 2010-2012,2015,2017                      CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -106,6 +106,8 @@ static struct starpu_perfmodel STARPU_PLU(model_22) =
 	.symbol = STARPU_PLU_STR(lu_model_22_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_PLU_STR(lu_model_22_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_PLU_STR(lu_model_22_openblas)
 #else
 	.symbol = STARPU_PLU_STR(lu_model_22)
 #endif
@@ -218,6 +220,8 @@ static struct starpu_perfmodel STARPU_PLU(model_12) =
 	.symbol = STARPU_PLU_STR(lu_model_12_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_PLU_STR(lu_model_12_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_PLU_STR(lu_model_12_openblas)
 #else
 	.symbol = STARPU_PLU_STR(lu_model_12)
 #endif
@@ -331,6 +335,8 @@ static struct starpu_perfmodel STARPU_PLU(model_21) =
 	.symbol = STARPU_PLU_STR(lu_model_21_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_PLU_STR(lu_model_21_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_PLU_STR(lu_model_21_openblas)
 #else
 	.symbol = STARPU_PLU_STR(lu_model_21)
 #endif
@@ -441,6 +447,8 @@ static struct starpu_perfmodel STARPU_PLU(model_11) =
 	.symbol = STARPU_PLU_STR(lu_model_11_atlas)
 #elif defined(STARPU_GOTO)
 	.symbol = STARPU_PLU_STR(lu_model_11_goto)
+#elif defined(STARPU_OPENBLAS)
+	.symbol = STARPU_PLU_STR(lu_model_11_openblas)
 #else
 	.symbol = STARPU_PLU_STR(lu_model_11)
 #endif