From 9e5b934d211d5ba56d34510d3df8c40bf0105fd6 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Tue, 2 Aug 2016 17:26:54 +0100 Subject: [PATCH] improved LAPACK configuration --- benchmarks/Makefile.am | 3 +-- configure.ac | 36 +++++++++++++++++------------------- lib/Makefile.am | 2 -- tests/IO/Makefile.am | 14 +------------- tests/Makefile.am | 12 +----------- tests/core/Makefile.am | 14 +------------- tests/debug/Makefile.am | 14 +------------- tests/forces/Makefile.am | 14 +------------- tests/hmc/Makefile.am | 14 +------------- tests/qdpxx/Makefile.am | 6 ++---- tests/solver/Makefile.am | 14 +------------- 11 files changed, 27 insertions(+), 116 deletions(-) diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 05affc99..d8c00e16 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -1,4 +1,3 @@ -# additional include paths necessary to compile the C++ library -AM_LDFLAGS = -L$(top_builddir)/lib +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/configure.ac b/configure.ac index bc76469b..32e660ed 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,19 @@ AC_ARG_WITH([mpfr], [try this for a non-standard install prefix of the MPFR library])], [AM_CXXFLAGS="$AM_CXXFLAGS -I$with_mpfr/include"] [AM_LDFLAGS="$AM_LDFLAGS -L$with_mpfr/lib"]) +AC_ARG_ENABLE([lapack], + [AC_HELP_STRING([--enable-lapack=yes|no|prefix], [enable LAPACK])], + [ac_LAPACK=${enable_lapack}],[ac_LAPACK=no]) +case ${ac_LAPACK} in + no) + ;; + yes) + AC_DEFINE([USE_LAPACK],[1],[use LAPACK]);; + *) + AM_CXXFLAGS="$AM_CXXFLAGS -I$ac_LAPACK/include" + AM_LDFLAGS="$AM_LDFLAGS -L$ac_LAPACK/lib" + AC_DEFINE([USE_LAPACK],[1],[use LAPACK]) +esac ################ Get compiler informations AC_LANG([C++]) @@ -53,6 +66,10 @@ AC_DEFINE_UNQUOTED([GXX_VERSION],["$GXX_VERSION"], AC_CHECK_FUNCS([gettimeofday]) AC_CHECK_LIB([gmp],[__gmpf_init],[],[]) AC_CHECK_LIB([mpfr],[mpfr_init],[],[]) +if test "${ac_LAPACK}x" != "nox"; then + AC_CHECK_LIB([lapack],[LAPACKE_sbdsdc],[], + [AC_MSG_ERROR("LAPACK enabled but library not found")]) +fi ############### SIMD instruction selection AC_ARG_ENABLE([simd],[AC_HELP_STRING([--enable-simd=SSE4|AVX|AVXFMA4|AVX2|AVX512|AVX512MIC|IMCI|KNL|KNC],\ @@ -208,27 +225,8 @@ case ${ac_CHROMA} in AC_MSG_ERROR([${ac_CHROMA} unsupported --enable-chroma option]); ;; esac - AM_CONDITIONAL(BUILD_CHROMA_REGRESSION,[ test "X${ac_CHROMA}X" == "XyesX" ]) -############### Lapack -AC_ARG_ENABLE([lapack],[AC_HELP_STRING([--enable-lapack],[Enable lapack yes/no ])],[ac_LAPACK=${enable_lapack}],[ac_LAPACK=no]) - -case ${ac_LAPACK} in - yes) - echo Enabling lapack - ;; - no) - echo Disabling lapack - ;; - *) - echo Enabling lapack at ${ac_LAPACK} - ;; -esac - -AM_CONDITIONAL(USE_LAPACK,[ test "X${ac_LAPACK}X" != "XnoX" ]) -AM_CONDITIONAL(USE_LAPACK_LIB,[ test "X${ac_LAPACK}X" != "XyesX" ]) - ############### Doxygen AC_PROG_DOXYGEN diff --git a/lib/Makefile.am b/lib/Makefile.am index ee287659..a7ef229a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,3 @@ -# additional include paths necessary to compile the C++ library - extra_sources= if BUILD_COMMS_MPI extra_sources+=communicator/Communicator_mpi.cc diff --git a/tests/IO/Makefile.am b/tests/IO/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/IO/Makefile.am +++ b/tests/IO/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/Makefile.am b/tests/Makefile.am index cee0a656..d3b16509 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,16 +4,6 @@ if BUILD_CHROMA_REGRESSION SUBDIRS+= qdpxx endif -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/core/Makefile.am b/tests/core/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/core/Makefile.am +++ b/tests/core/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/debug/Makefile.am b/tests/debug/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/debug/Makefile.am +++ b/tests/debug/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/forces/Makefile.am b/tests/forces/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/forces/Makefile.am +++ b/tests/forces/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/hmc/Makefile.am b/tests/hmc/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/hmc/Makefile.am +++ b/tests/hmc/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc diff --git a/tests/qdpxx/Makefile.am b/tests/qdpxx/Makefile.am index c0119c40..4c9d01ea 100644 --- a/tests/qdpxx/Makefile.am +++ b/tests/qdpxx/Makefile.am @@ -1,6 +1,4 @@ -# additional include paths necessary to compile the C++ library - -AM_CXXFLAGS = `chroma-config --cxxflags` -AM_LDFLAGS = -L$(top_builddir)/lib `chroma-config --ldflags` `chroma-config --libs` +AM_CXXFLAGS += `chroma-config --cxxflags` +AM_LDFLAGS += -L$(top_builddir)/lib `chroma-config --ldflags` `chroma-config --libs` include Make.inc diff --git a/tests/solver/Makefile.am b/tests/solver/Makefile.am index d7ccf25f..d8c00e16 100644 --- a/tests/solver/Makefile.am +++ b/tests/solver/Makefile.am @@ -1,15 +1,3 @@ -# additional include paths necessary to compile the C++ library - -AM_LDFLAGS = -L$(top_builddir)/lib - -if USE_LAPACK -AM_CXXFLAGS += -DUSE_LAPACK -if USE_LAPACK_LIB -#if test "X${ac_LAPACK}X" != XyesX -AM_CXXFLAGS += -I$(ac_LAPACK)/include -AM_LDFLAGS += -L$(ac_LAPACK)/lib -#fi -endif -endif +AM_LDFLAGS += -L$(top_builddir)/lib include Make.inc