浏览代码

move blas link flags to STARPU_BLAS_LDFLAGS

Samuel Thibault 14 年之前
父节点
当前提交
fe23677913
共有 4 个文件被更改,包括 65 次插入16 次删除
  1. 9 9
      configure.ac
  2. 40 1
      examples/Makefile.am
  3. 9 2
      m4/libs.m4
  4. 7 4
      mpi/Makefile.am

+ 9 - 9
configure.ac

@@ -313,7 +313,7 @@ AC_DEFUN([STARPU_CHECK_CUDA_RUNTIME],
     if test "$have_valid_cuda" = "yes" ; then
         STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcudart"
 	# we also check that CUBLAS is available
-	AC_HAVE_LIBRARY([cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
+	STARPU_HAVE_LIBRARY(CUBLAS,[cublas],[have_valid_cuda=yes],[have_valid_cuda=no])
         unset ac_cv_lib_cublas_main
         if test "$have_valid_cuda" = "yes" ; then
             STARPU_CUDA_LDFLAGS="$STARPU_CUDA_LDFLAGS -lcublas"
@@ -427,8 +427,8 @@ if test x$enable_cuda = xyes; then
 		if test -d "$magma_dir/lib/"; then
 			LDFLAGS="${SAVED_LDFLAGS} -L$magma_dir/lib/ "
 			have_valid_magma=yes
-			AC_CHECK_LIB(magmablas, main,,[have_valid_magma=no])
-			AC_CHECK_LIB(magma, magmablas_sgemm,,[have_valid_magma=no])
+			STARPU_CHECK_LIB(BLAS, magmablas, main,,[have_valid_magma=no])
+			STARPU_CHECK_LIB(BLAS, magma, magmablas_sgemm,,[have_valid_magma=no])
 		fi
 
 		if test -d "$magma_dir/include/"; then
@@ -1154,11 +1154,11 @@ AC_ARG_WITH(goto-dir, [AS_HELP_STRING([--with-goto-dir=<dir>], [specify GotoBLAS
 	)
 
 if test x$blas_lib = xgoto; then
-AC_CHECK_LIB(gfortran, main,,)
+STARPU_CHECK_LIB(BLAS, gfortran, main,,)
 # Perhaps that GotoBLAS2 is available instead (so that we have libgotoblas2.{so,a})
-AC_CHECK_LIB(goto2, sgemm_,, [havegoto2=no])
+STARPU_CHECK_LIB(BLAS, goto2, sgemm_,, [havegoto2=no])
 if test x$havegoto2 = xno; then
-AC_CHECK_LIB(goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
+STARPU_CHECK_LIB(BLAS, goto, sgemm_,,AC_MSG_ERROR([cannot find goto lib]))
 fi
 AC_DEFINE(STARPU_GOTO, [1], [use STARPU_GOTO library])
 fi
@@ -1182,8 +1182,8 @@ AC_ARG_WITH(atlas-dir, [AS_HELP_STRING([--with-atlas-dir=<dir>], [specify ATLAS
 if test x$blas_lib = xatlas; then
 # test whether STARPU_ATLAS is actually available
 AC_CHECK_HEADER([cblas.h],,AC_MSG_ERROR([cannot find atlas headers]))
-AC_CHECK_LIB(atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
-AC_CHECK_LIB(cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
+STARPU_CHECK_LIB(BLAS, atlas, ATL_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),)
+STARPU_CHECK_LIB(BLAS, cblas, cblas_sgemm,,AC_MSG_ERROR([cannot find atlas lib]),[-latlas])
 AC_DEFINE(STARPU_ATLAS, [1], [use STARPU_ATLAS library])
 fi
 
@@ -1210,7 +1210,7 @@ fi
 if test x$blas_lib = xmaybe; then
      #perhaps it is possible to use some BLAS lib from the system
      use_system_blas=no
-     AC_SEARCH_LIBS([sgemm_],[blas],use_system_blas=yes,,)
+     STARPU_SEARCH_LIBS(BLAS,[sgemm_],[blas],use_system_blas=yes,,)
      if test x$use_system_blas = xyes; then
         AC_DEFINE(STARPU_SYSTEM_BLAS, [1], [use refblas library])
 	blas_lib=system

+ 40 - 1
examples/Makefile.am

@@ -306,6 +306,9 @@ axpy_axpy_SOURCES =				\
 	axpy/axpy.c				\
 	common/blas.c
 
+axpy_axpy_LDADD =				\
+	$(STARPU_BLAS_LDFLAGS)
+
 endif
 
 ################
@@ -326,10 +329,16 @@ mult_sgemm_SOURCES = 				\
 	mult/sgemm.c				\
 	common/blas.c
 
+mult_sgemm_LDADD =				\
+	$(STARPU_BLAS_LDFLAGS)
+
 mult_dgemm_SOURCES = 				\
 	mult/dgemm.c				\
 	common/blas.c
 
+mult_dgemm_LDADD =				\
+	$(STARPU_BLAS_LDFLAGS)
+
 endif
 
 ####################
@@ -356,24 +365,36 @@ cholesky_cholesky_tag_SOURCES =			\
 	cholesky/cholesky_kernels.c		\
 	common/blas.c
 
+cholesky_cholesky_tag_LDADD =			\
+	$(STARPU_BLAS_LDFLAGS)
+
 cholesky_cholesky_tile_tag_SOURCES =		\
 	cholesky/cholesky_tile_tag.c		\
 	cholesky/cholesky_models.c		\
 	cholesky/cholesky_kernels.c		\
 	common/blas.c
 
+cholesky_cholesky_tile_tag_LDADD =		\
+	$(STARPU_BLAS_LDFLAGS)
+
 cholesky_cholesky_grain_tag_SOURCES =		\
 	cholesky/cholesky_grain_tag.c		\
 	cholesky/cholesky_models.c		\
 	cholesky/cholesky_kernels.c		\
 	common/blas.c
 
+cholesky_cholesky_grain_tag_LDADD =		\
+	$(STARPU_BLAS_LDFLAGS)
+
 cholesky_cholesky_implicit_SOURCES =		\
 	cholesky/cholesky_implicit.c		\
 	cholesky/cholesky_models.c		\
 	cholesky/cholesky_kernels.c		\
 	common/blas.c
 
+cholesky_cholesky_implicit_LDADD =		\
+	$(STARPU_BLAS_LDFLAGS)
+
 endif
 
 ##############
@@ -397,6 +418,9 @@ lu_lu_example_float_SOURCES =			\
 	lu/slu_kernels.c			\
 	common/blas.c
 
+lu_lu_example_float_LDADD =			\
+	$(STARPU_BLAS_LDFLAGS)
+
 lu_lu_example_double_SOURCES =			\
 	lu/lu_example_double.c			\
 	lu/dlu.c				\
@@ -404,6 +428,9 @@ lu_lu_example_double_SOURCES =			\
 	lu/dlu_kernels.c			\
 	common/blas.c
 
+lu_lu_example_double_LDADD =			\
+	$(STARPU_BLAS_LDFLAGS)
+
 check_PROGRAMS += 				\
 	lu/lu_implicit_example_float		\
 	lu/lu_implicit_example_double
@@ -419,6 +446,9 @@ lu_lu_implicit_example_float_SOURCES =		\
 	lu/slu_kernels.c			\
 	common/blas.c
 
+lu_lu_implicit_example_float_LDADD =		\
+	$(STARPU_BLAS_LDFLAGS)
+
 lu_lu_implicit_example_double_SOURCES =		\
 	lu/lu_example_double.c			\
 	lu/dlu_implicit.c			\
@@ -426,6 +456,8 @@ lu_lu_implicit_example_double_SOURCES =		\
 	lu/dlu_kernels.c			\
 	common/blas.c
 
+lu_lu_implicit_example_double_LDADD =		\
+	$(STARPU_BLAS_LDFLAGS)
 endif
 
 
@@ -452,7 +484,8 @@ heat_heat_SOURCES =				\
 	common/blas.c
 
 heat_heat_LDADD =				\
-	$(STARPU_OPENGL_RENDER_LDFLAGS)
+	$(STARPU_OPENGL_RENDER_LDFLAGS)		\
+	$(STARPU_BLAS_LDFLAGS)
 
 endif
 
@@ -476,6 +509,9 @@ cg_cg_SOURCES +=				\
 	cg/cg_dot_kernel.cu
 endif
 
+cg_cg_LDADD =					\
+	$(STARPU_BLAS_LDFLAGS)
+
 endif
 
 
@@ -539,6 +575,9 @@ spmv_dw_block_spmv_SOURCES =			\
 	spmv/dw_block_spmv_kernels.c		\
 	spmv/matrix_market/mm_to_bcsr.c		\
 	spmv/matrix_market/mmio.c
+
+spmv_dw_block_spmv_LDADD =			\
+	$(STARPU_BLAS_LDFLAGS)
 endif
 
 ####################

+ 9 - 2
m4/libs.m4

@@ -26,7 +26,7 @@ AC_DEFUN([STARPU_SEARCH_LIBS], [dnl
 	STARPU_$1_LDFLAGS="$STARPU_$1_LDFLAGS $LIBS"
 	LIBS=$_LIBS_SAV
 	AC_SUBST(STARPU_$1_LDFLAGS)
-])
+])dnl
 
 # STARPU_CHECK_LIB(NAME, LIBRARY, FUNCTION,
 #                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
@@ -41,4 +41,11 @@ AC_DEFUN([STARPU_CHECK_LIB], [dnl
 	STARPU_$1_LDFLAGS="$STARPU_$1_LDFLAGS $LIBS"
 	LIBS=$_LIBS_SAV
 	AC_SUBST(STARPU_$1_LDFLAGS)
-])
+])dnl
+
+# AC_HAVE_LIBRARY(NAME, LIBRARY,
+#                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                 [OTHER-LIBRARIES])
+AC_DEFUN([STARPU_HAVE_LIBRARY], [dnl
+STARPU_CHECK_LIB([$1], [$2], main, [$3], [$4], [$5])
+])dnl

+ 7 - 4
mpi/Makefile.am

@@ -102,7 +102,8 @@ examplebin_PROGRAMS += 				\
 
 examples_mpi_lu_plu_example_float_LDADD =	\
 	libstarpumpi.la				\
-	$(STARPU_LIBNUMA_LDFLAGS)
+	$(STARPU_LIBNUMA_LDFLAGS)		\
+	$(STARPU_BLAS_LDFLAGS)
 
 examples_mpi_lu_plu_example_float_SOURCES =	\
 	examples/mpi_lu/plu_example_float.c	\
@@ -113,7 +114,8 @@ examples_mpi_lu_plu_example_float_SOURCES =	\
 
 examples_mpi_lu_plu_example_double_LDADD =	\
 	libstarpumpi.la				\
-	$(STARPU_LIBNUMA_LDFLAGS)
+	$(STARPU_LIBNUMA_LDFLAGS)		\
+	$(STARPU_BLAS_LDFLAGS)
 
 examples_mpi_lu_plu_example_double_SOURCES =	\
 	examples/mpi_lu/plu_example_double.c	\
@@ -137,8 +139,9 @@ examples_cholesky_mpi_cholesky_SOURCES	=		\
 	examples/cholesky/mpi_cholesky_kernels.c	\
 	$(top_srcdir)/examples/common/blas.c
 
-examples_cholesky_mpi_cholesky_LDADD =	\
-	libstarpumpi.la
+examples_cholesky_mpi_cholesky_LDADD =			\
+	libstarpumpi.la					\
+	$(STARPU_BLAS_LDFLAGS)
 endif
 
 check_PROGRAMS +=					\