From 4cadf11d1d4f57f28f564d3d779e82353c8c8d38 Mon Sep 17 00:00:00 2001 From: neo Date: Tue, 19 May 2015 13:54:55 +0900 Subject: [PATCH] Added check of mpfr and gmp at configure time It generates automatically the linker flags or complains if not found. --- README | 2 + configure | 104 +++++++++++++++++++++++++ configure.ac | 16 +++- lib/Grid_config.h | 121 ----------------------------- lib/Grid_config.h.in | 6 ++ lib/Makefile.am | 3 +- lib/algorithms/approx/.dirstamp | 0 lib/algorithms/approx/Remez.cc | 0 lib/algorithms/approx/Remez.h | 0 lib/algorithms/approx/Zolotarev.cc | 0 lib/algorithms/approx/Zolotarev.h | 0 lib/algorithms/approx/bigfloat.h | 0 lib/communicator/.dirstamp | 0 lib/qcd/.dirstamp | 0 lib/simd/Grid_sse4.cpp | 19 +++++ lib/simd/Grid_vector_types.h | 8 +- lib/stamp-h1 | 1 - lib/stencil/.dirstamp | 0 18 files changed, 155 insertions(+), 125 deletions(-) delete mode 100644 lib/Grid_config.h delete mode 100644 lib/algorithms/approx/.dirstamp mode change 100755 => 100644 lib/algorithms/approx/Remez.cc mode change 100755 => 100644 lib/algorithms/approx/Remez.h mode change 100755 => 100644 lib/algorithms/approx/Zolotarev.cc mode change 100755 => 100644 lib/algorithms/approx/Zolotarev.h mode change 100755 => 100644 lib/algorithms/approx/bigfloat.h delete mode 100644 lib/communicator/.dirstamp delete mode 100644 lib/qcd/.dirstamp create mode 100644 lib/simd/Grid_sse4.cpp delete mode 100644 lib/stamp-h1 delete mode 100644 lib/stencil/.dirstamp diff --git a/README b/README index 41b66b6b..17e92fa0 100644 --- a/README +++ b/README @@ -33,6 +33,8 @@ MPI parallelism is UNIMPLEMENTED and for now only OpenMP and SIMD parallelism is by setting variables in the command line or in the environment. Here is are examples: + ./configure CXX=clang++ CXXFLAGS="-std=c++11 -O3 -msse4" --enable-simd=SSE4 + ./configure CXX=clang++ CXXFLAGS="-std=c++11 -O3 -mavx" --enable-simd=AVX1 ./configure CXX=clang++ CXXFLAGS="-std=c++11 -O3 -mavx2" --enable-simd=AVX2 diff --git a/configure b/configure index e7d9f32f..8c9e8c59 100755 --- a/configure +++ b/configure @@ -4502,6 +4502,11 @@ _ACEOF # Checks for library functions. +echo +echo Checking libraries +echo ::::::::::::::::::::::::::::::::::::::::::: + + for ac_func in gettimeofday do : ac_fn_cxx_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" @@ -4514,6 +4519,105 @@ fi done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __gmpf_init in -lgmp" >&5 +$as_echo_n "checking for __gmpf_init in -lgmp... " >&6; } +if ${ac_cv_lib_gmp___gmpf_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgmp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __gmpf_init (); +int +main () +{ +return __gmpf_init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_gmp___gmpf_init=yes +else + ac_cv_lib_gmp___gmpf_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpf_init" >&5 +$as_echo "$ac_cv_lib_gmp___gmpf_init" >&6; } +if test "x$ac_cv_lib_gmp___gmpf_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGMP 1 +_ACEOF + + LIBS="-lgmp $LIBS" + +else + as_fn_error $? "GNU Multiple Precision GMP library was not found in your system. +Please install or provide the correct path to your installation +Info at: http://www.gmplib.org" "$LINENO" 5 +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpfr_init in -lmpfr" >&5 +$as_echo_n "checking for mpfr_init in -lmpfr... " >&6; } +if ${ac_cv_lib_mpfr_mpfr_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpfr $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char mpfr_init (); +int +main () +{ +return mpfr_init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_mpfr_mpfr_init=yes +else + ac_cv_lib_mpfr_mpfr_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpfr_mpfr_init" >&5 +$as_echo "$ac_cv_lib_mpfr_mpfr_init" >&6; } +if test "x$ac_cv_lib_mpfr_mpfr_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMPFR 1 +_ACEOF + + LIBS="-lmpfr $LIBS" + +else + as_fn_error $? "GNU Multiple Precision MPFR library was not found in your system. +Please install or provide the correct path to your installation +Info at: http://www.mpfr.org/" "$LINENO" 5 +fi + diff --git a/configure.ac b/configure.ac index 14170f4e..93e2b574 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # # Project Grid package # -# Time-stamp: <2015-05-18 17:14:20 neo> +# Time-stamp: <2015-05-19 13:51:08 neo> AC_PREREQ([2.69]) AC_INIT([Grid], [1.0], [paboyle@ph.ed.ac.uk]) @@ -46,8 +46,22 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T # Checks for library functions. +echo +echo Checking libraries +echo ::::::::::::::::::::::::::::::::::::::::::: + + AC_CHECK_FUNCS([gettimeofday]) +AC_CHECK_LIB([gmp],[__gmpf_init],, + [AC_MSG_ERROR(GNU Multiple Precision GMP library was not found in your system. +Please install or provide the correct path to your installation +Info at: http://www.gmplib.org)]) + +AC_CHECK_LIB([mpfr],[mpfr_init],, + [AC_MSG_ERROR(GNU Multiple Precision MPFR library was not found in your system. +Please install or provide the correct path to your installation +Info at: http://www.mpfr.org/)]) diff --git a/lib/Grid_config.h b/lib/Grid_config.h deleted file mode 100644 index e1674850..00000000 --- a/lib/Grid_config.h +++ /dev/null @@ -1,121 +0,0 @@ -/* lib/Grid_config.h. Generated from Grid_config.h.in by configure. */ -/* lib/Grid_config.h.in. Generated from configure.ac by autoheader. */ - -/* AVX */ -/* #undef AVX1 */ - -/* AVX2 */ -/* #undef AVX2 */ - -/* AVX512 */ -/* #undef AVX512 */ - -/* GRID_COMMS_MPI */ -/* #undef GRID_COMMS_MPI */ - -/* GRID_COMMS_NONE */ -#define GRID_COMMS_NONE 1 - -/* Define to 1 if you have the declaration of `be64toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE64TOH 1 - -/* Define to 1 if you have the declaration of `ntohll', and to 0 if you don't. - */ -#define HAVE_DECL_NTOHLL 0 - -/* Define to 1 if you have the header file. */ -#define HAVE_ENDIAN_H 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_GMP_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_MALLOC_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MM_MALLOC_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Name of package */ -#define PACKAGE "grid" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "paboyle@ph.ed.ac.uk" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Grid" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Grid 1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "grid" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0" - -/* SSE4 */ -#define SSE4 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.0" - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT32_T */ - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint32_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ diff --git a/lib/Grid_config.h.in b/lib/Grid_config.h.in index 0ce09cf5..b7f56d5b 100644 --- a/lib/Grid_config.h.in +++ b/lib/Grid_config.h.in @@ -35,6 +35,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `gmp' library (-lgmp). */ +#undef HAVE_LIBGMP + +/* Define to 1 if you have the `mpfr' library (-lmpfr). */ +#undef HAVE_LIBMPFR + /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H diff --git a/lib/Makefile.am b/lib/Makefile.am index 938f7ca1..557295d5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -95,5 +95,6 @@ nobase_include_HEADERS = algorithms/approx/bigfloat.h\ simd/Grid_vComplexF.h\ simd/Grid_vInteger.h\ simd/Grid_vRealD.h\ - simd/Grid_vRealF.h + simd/Grid_vRealF.h\ + simd/Grid_vector_types.h diff --git a/lib/algorithms/approx/.dirstamp b/lib/algorithms/approx/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/algorithms/approx/Remez.cc b/lib/algorithms/approx/Remez.cc old mode 100755 new mode 100644 diff --git a/lib/algorithms/approx/Remez.h b/lib/algorithms/approx/Remez.h old mode 100755 new mode 100644 diff --git a/lib/algorithms/approx/Zolotarev.cc b/lib/algorithms/approx/Zolotarev.cc old mode 100755 new mode 100644 diff --git a/lib/algorithms/approx/Zolotarev.h b/lib/algorithms/approx/Zolotarev.h old mode 100755 new mode 100644 diff --git a/lib/algorithms/approx/bigfloat.h b/lib/algorithms/approx/bigfloat.h old mode 100755 new mode 100644 diff --git a/lib/communicator/.dirstamp b/lib/communicator/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/qcd/.dirstamp b/lib/qcd/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/simd/Grid_sse4.cpp b/lib/simd/Grid_sse4.cpp new file mode 100644 index 00000000..b0be164b --- /dev/null +++ b/lib/simd/Grid_sse4.cpp @@ -0,0 +1,19 @@ +//---------------------------------------------------------------------- +/*! @file Grid_vector_types.h + @brief Defines templated class to deal with inner vector types +*/ +// Time-stamp: <2015-05-19 13:53:47 neo> +//---------------------------------------------------------------------- + +namespace Optimization { + + + + +} + +// Here assign types +namespace Grid { + + +} diff --git a/lib/simd/Grid_vector_types.h b/lib/simd/Grid_vector_types.h index 360e9f1b..7c2b1bed 100644 --- a/lib/simd/Grid_vector_types.h +++ b/lib/simd/Grid_vector_types.h @@ -1,3 +1,9 @@ +//---------------------------------------------------------------------- +/*! @file Grid_vector_types.h + @brief Defines templated class to deal with inner vector types +*/ +// Time-stamp: <2015-05-19 13:41:47 neo> +//---------------------------------------------------------------------- #ifndef GRID_VECTOR_TYPES #define GRID_VECTOR_TYPES @@ -13,8 +19,8 @@ namespace Grid { struct RealPart< std::complex >{ typedef T type; }; - //////////////////////////////////////////////////////// + //////////////////////////////////////////////////////// // Check for complexity with type traits template struct is_complex : std::false_type {}; diff --git a/lib/stamp-h1 b/lib/stamp-h1 deleted file mode 100644 index 753f890f..00000000 --- a/lib/stamp-h1 +++ /dev/null @@ -1 +0,0 @@ -timestamp for lib/Grid_config.h diff --git a/lib/stencil/.dirstamp b/lib/stencil/.dirstamp deleted file mode 100644 index e69de29b..00000000