1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 12:23:56 +01:00
qmckl/configure.ac

643 lines
19 KiB
Plaintext
Raw Normal View History

2021-05-07 12:47:56 +02:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
2021-05-10 23:56:26 +02:00
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
2021-10-06 13:01:11 +02:00
#
2021-05-10 23:56:26 +02:00
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_PREREQ([2.69])
2024-04-10 16:38:10 +02:00
AC_INIT([qmckl],[1.0.0],[https://github.com/TREX-CoE/qmckl/issues],[],[https://trex-coe.github.io/qmckl/index.html])
2021-11-09 18:59:46 +01:00
AC_CONFIG_AUX_DIR([tools])
2021-05-11 12:56:41 +02:00
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])
2021-11-01 10:43:08 +01:00
2022-11-24 16:21:11 +01:00
# Activate developer mode when the .maintainer_mode file is found
2021-11-01 10:43:08 +01:00
# Otherwise, it is the source distribution and the developer mode should not be activated.
2022-11-24 16:21:11 +01:00
AS_IF([test -f ${srcdir}/.maintainer_mode],
2021-11-01 10:43:08 +01:00
[enable_maintainer_mode="yes"],
2021-11-09 18:59:46 +01:00
[enable_maintainer_mode="no"]
2021-11-01 10:43:08 +01:00
)
2022-09-22 13:37:29 +02:00
# Intel Fortran compiler
AC_ARG_WITH([ifort],
[AS_HELP_STRING([--with-ifort],
[Use Intel Fortran compiler])],
[with_ifort=$withval],
[with_ifort=no])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$with_ifort" = "xyes"], [
FC=ifort
2024-12-13 14:36:51 +01:00
FCFLAGS="-march=native -ip -O3 -ftz -finline -g -mkl=sequential" ])
2022-09-22 13:37:29 +02:00
# Intel C compiler
2023-11-28 12:44:35 +01:00
AC_ARG_WITH([icx],
[AS_HELP_STRING([--with-icx],
[Use Intel C compiler])],
[with_icx=$withval],
[with_icx=no])
AS_IF([test "x$with_icx" = "xyes"], [
CC=icx
2024-12-13 14:36:51 +01:00
CFLAGS="-march=native -O3 -ftz -finline -g -qmkl=sequential" ])
2023-11-28 12:44:35 +01:00
AS_IF([test "x$with_icx.$with_ifort" = "xyes.yes"], [
ax_blas_ok="yes"
ax_lapack_ok="yes"
BLAS_LIBS=""
LAPACK_LIBS=""])
2022-09-22 13:37:29 +02:00
AC_ARG_WITH([icc],
[AS_HELP_STRING([--with-icc],
[Use Intel C compiler])],
[with_icc=$withval],
[with_icc=no])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$with_icc" = "xyes"], [
2022-02-15 16:42:47 +01:00
CC=icc
2024-12-13 14:36:51 +01:00
CFLAGS="-march=native -ip -O3 -ftz -finline -g -mkl=sequential" ])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$with_icc.$with_ifort" = "xyes.yes"], [
ax_blas_ok="yes"
ax_lapack_ok="yes"
BLAS_LIBS=""
LAPACK_LIBS=""])
2022-09-22 13:37:29 +02:00
# Default Automake variables
2023-01-17 15:40:00 +01:00
F77=$FC
2021-11-09 18:59:46 +01:00
AM_PROG_AR
2021-05-10 23:56:26 +02:00
AM_MAINTAINER_MODE()
LT_INIT
2021-10-28 17:52:03 +02:00
AC_CONFIG_SRCDIR([configure.ac])
2021-05-09 02:12:38 +02:00
AC_CONFIG_HEADERS([include/config.h])
2021-05-07 12:47:56 +02:00
AC_CONFIG_MACRO_DIR([m4])
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1`
2021-10-14 10:50:51 +02:00
AC_DEFINE_UNQUOTED([QMCKL_VERSION_MAJOR], [$VERSION_MAJOR], [major version])
AC_DEFINE_UNQUOTED([QMCKL_VERSION_MINOR], [$VERSION_MINOR], [minor version])
AC_DEFINE_UNQUOTED([QMCKL_VERSION_PATCH], [$VERSION_PATCH], [patch version])
2021-05-10 23:56:26 +02:00
AC_SUBST([VERSION_MAJOR])
AC_SUBST([VERSION_MINOR])
AC_SUBST([VERSION_PATCH])
2021-05-04 17:10:20 +02:00
2022-09-22 13:37:29 +02:00
AM_SILENT_RULES(yes)
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_LANG(C)
# Checks for programs.
AC_PROG_CC
AC_PROG_F77
2021-06-03 01:32:50 +02:00
# Make sure the c compiler supports C99
m4_version_prereq([2.70],[], [AC_PROG_CC_C99])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [AC_MSG_ERROR([The compiler does not support C99])])
2021-05-07 12:47:56 +02:00
AC_PROG_CC_C_O
2022-04-06 10:03:56 +02:00
AM_PROG_CC_C_O
2021-05-07 12:47:56 +02:00
AC_PROG_FC
2021-05-04 17:10:20 +02:00
AC_PROG_FC_C_O
AC_FC_PP_DEFINE
AC_FC_SRCEXT([F90])
2021-05-04 17:10:20 +02:00
AC_FC_FREEFORM
2021-05-07 12:47:56 +02:00
AC_PROG_INSTALL
AC_PROG_LN_S
2021-05-10 23:56:26 +02:00
PKG_PROG_PKG_CONFIG([])
2021-05-07 12:47:56 +02:00
# Checks for libraries.
2022-09-22 16:43:57 +02:00
PKG_LIBS=""
PKG_CFLAGS=""
PKG_LIBS2=""
PKG_CFLAGS2=""
2021-05-07 12:47:56 +02:00
AC_FC_LIBRARY_LDFLAGS
AC_CHECK_LIB([m], [sqrt])
2021-05-12 23:51:59 +02:00
AC_CHECK_HEADERS([assert.h errno.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
2021-05-07 12:47:56 +02:00
## pthread
2021-05-04 17:10:20 +02:00
AC_CHECK_LIB([pthread], [pthread_create])
2021-05-07 12:47:56 +02:00
# OpenMP
2022-10-07 09:36:06 +02:00
AC_ARG_WITH(openmp, [AS_HELP_STRING([--without-openmp],[deactivate OpenMP])], with_omp=$withval, with_omp=yes)
2022-10-20 15:44:11 +02:00
AS_IF([test "x$with_omp" = xyes], [
2022-02-15 16:42:47 +01:00
AC_DEFINE([HAVE_OPENMP], [1], [Define to use OpenMP threading.])
AX_OPENMP([],
[AC_MSG_ERROR([Could not find OpenMP flags; configure with --without-openmp])])
CFLAGS="${CFLAGS} ${OPENMP_CFLAGS}"
FCFLAGS="${CFLAGS} ${OPENMP_FCFLAGS}"
2022-10-20 15:44:11 +02:00
])
2021-05-07 12:47:56 +02:00
# CHAMELEON
2022-09-22 13:37:29 +02:00
#AC_ARG_WITH(chameleon,
# AS_HELP_STRING([--without-chameleon],
# [Do not use Chameleon. Default: auto-detect]),
# [case "$with_chameleon" in
# no)
# : ;;
# yes)
# PKG_CHECK_MODULES([LIBCHAMELEON],[chameleon >= 1.0.0],
# [PKG_CFLAGS="$PKG_CFLAGS $LIBCHAMELEON_CFLAGS"
2022-09-22 16:43:57 +02:00
# PKG_LIBS2="$PKG_LIBS2 $LIBCHAMELEON_LIBS"]
2022-09-22 13:37:29 +02:00
# ,[
#
# ## something went wrong.
# ## try to find the package without pkg-config
#
# ## check that the library is actually new enough.
# ## by testing for a 1.0.0+ function which we use
# AC_CHECK_LIB(chameleon,CHAMELEON_finalize,[LIBCHAMELEON_LIBS="-lchameleon"])
# ])
# AH_TEMPLATE(HAVE_CHAMELEON,[Chameleon support is available])
# ;;
# *)
# if test ! -d "$withval" ; then
# AC_MSG_ERROR([--with-chameleon argument does not point to a directory])
# fi
# LIBCHAMELEON_LIBS="-L$with_chameleon/lib -lchameleon -lchameleon_starpu -lhqr -lcoreblas"
# LIBCHAMELEON_CFLAGS="-I$with_chameleon/include $CFLAGS"
# LIBCHAMELEON_CPPFLAGS="-I$with_chameleon/include $CPPFLAGS"
# esac
# ])
#
#if test "x$LIBCHAMELEON_LIBS" != "x" ; then
# LIBS="$LIBS $LIBCHAMELEON_LIBS"
# CFLAGS="$CFLAGS $LIBCHAMELEON_CFLAGS"
# CPPFLAGS="$CPPFLAGS $LIBCHAMELEON_CPPFLAGS"
# AC_CHECK_HEADERS([chameleon.h], [], [AC_MSG_ERROR("chamelon.h not found")])
# AC_DEFINE_UNQUOTED([HAVE_CHAMELEON],1,[CHAMELEON support is available])
#fi
#
#AC_MSG_NOTICE([CHAMELEON library support: ${with_CHAMELEON:=auto} ${LIBCHAMELEON_PATH} ${LIBCHAMELEON_LIBS}])
# TREXIO
AC_ARG_WITH([trexio],
[AS_HELP_STRING([--without-trexio],
[disable support for TREXIO])],
[with_trexio=$withval],
[with_trexio=yes])
2022-09-22 13:56:52 +02:00
AS_CASE([$with_trexio],
[no], [],
[yes],
[AC_CHECK_LIB([trexio], [trexio_open], [],
[PKG_CHECK_MODULES([TREXIO], [trexio]) ])
2022-10-06 10:26:49 +02:00
CFLAGS="$CFLAGS $TREXIO_CFLAGS"
LIBS="$LIBS $TREXIO_LIBS"
2022-09-22 13:56:52 +02:00
AC_CHECK_HEADERS([trexio.h], [],
[AC_MSG_ERROR("trexio.h not found")])
AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
ARGS="${ARGS} trexio"],
[AS_IF([test ! -d "$withval"],
[AC_MSG_ERROR([--with-trexio=$withval: argument is not a directory])])
TREXIO_LIBS="-L$with_trexio/lib -ltrexio"
TREXIO_CFLAGS="-I$with_trexio/include"
2022-09-22 16:43:57 +02:00
CFLAGS="$CFLAGS $TREXIO_CFLAGS"
LIBS="$LIBS $TREXIO_LIBS"
2022-09-22 13:56:52 +02:00
AC_CHECK_HEADERS([trexio.h], [],
[AC_MSG_ERROR("trexio.h not found")])
AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
ARGS="${ARGS} trexio"
])
2021-10-06 13:01:11 +02:00
2022-09-22 16:43:57 +02:00
PKG_CFLAGS2="$PKG_CFLAGS2 $TREXIO_CFLAGS"
PKG_LIBS2="$PKG_LIBS2 $TREXIO_LIBS"
2021-10-06 13:01:11 +02:00
2023-01-17 15:40:00 +01:00
2022-09-22 13:56:52 +02:00
# QMCKLDGEMM
2022-09-22 13:37:29 +02:00
AC_ARG_WITH([qmckldgemm],
2022-09-22 13:56:52 +02:00
[AS_HELP_STRING([--with-qmckldgemm],
[enable support for QMCKL DGEMM])],
[with_qmckldgemm=$withval],
[with_qmckldgemm=no])
AS_CASE([$with_qmckldgemm],
[no], [],
[yes],
[AC_CHECK_LIB([qmckldgemm], [qmckl_packed_matrix_create], [],
[PKG_CHECK_MODULES([QMCKLDGEMM], [qmckldgemm]) ])
2022-10-06 10:26:49 +02:00
CFLAGS="$CFLAGS $QMCKLDGEMM_CFLAGS"
LIBS="$LIBS $QMCKLDGEMM_LIBS"
2022-09-22 16:43:57 +02:00
AC_CHECK_HEADERS([qmckl_dgemm.h], [],
[AC_MSG_ERROR("qmckl_dgemm.h not found")])
2022-09-22 13:56:52 +02:00
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm"],
[AS_IF([test ! -d "$withval"],
[AC_MSG_ERROR([--with-qmckldgemm=$withval: argument is not a directory])])
QMCKLDGEMM_LIBS="-L$with_qmckldgemm/lib -lqmckldgemm"
QMCKLDGEMM_CFLAGS="-I$with_qmckldgemm/include"
2022-09-22 16:43:57 +02:00
CFLAGS="$CFLAGS $QMCKLDGEMM_CFLAGS"
LIBS="$LIBS $QMCKLDGEMM_LIBS"
echo $CFLAGS
AC_CHECK_HEADERS([qmckl_dgemm.h], [],
[AC_MSG_ERROR("qmckl_dgemm.h not found")])
2022-09-22 13:56:52 +02:00
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm"
])
2022-09-22 16:43:57 +02:00
PKG_CFLAGS2="$PKG_CFLAGS2 $QMCKLDGEMM_CFLAGS"
PKG_LIBS2="$PKG_LIBS2 $QMCKLDGEMM_LIBS"
2022-08-09 16:01:26 +02:00
2021-05-07 12:47:56 +02:00
## BLAS
2021-12-12 20:02:43 +01:00
AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
2021-05-07 12:47:56 +02:00
## LAPACK
2021-12-12 20:02:43 +01:00
AX_LAPACK([], [AC_MSG_ERROR([LAPACK was not found.])])
2022-09-22 13:37:29 +02:00
AS_IF([test "$BLAS_LIBS" = "$LAPACK_LIBS"], [BLAS_LIBS=""])
2021-05-07 12:47:56 +02:00
2022-01-20 01:50:54 +01:00
# Specific options required with some compilers
2022-09-22 13:56:52 +02:00
AS_CASE([$FC],
[*ifort*], [FCFLAGS="$FCFLAGS -nofor-main"],
[*nvfortran*], [FCFLAGS="$FCFLAGS -fPIC -Mnomain"],
[*pgf90*], [FCFLAGS="$FCFLAGS -fPIC -Mnomain"],
[*pgf77*], [FCFLAGS="$FCFLAGS -fPIC -Mnomain"],
2022-09-22 13:56:52 +02:00
[])
2022-01-20 01:50:54 +01:00
2022-09-22 13:56:52 +02:00
AS_CASE([$CC],
[*gcc*], [CFLAGS="$CFLAGS -fPIC"],
[*nvc*], [CFLAGS="$CFLAGS -fPIC"],
[*pgcc*], [CFLAGS="$CFLAGS -fPIC"],
2022-09-22 13:56:52 +02:00
[])
2022-01-20 01:50:54 +01:00
2022-09-22 13:37:29 +02:00
# Options
AC_ARG_ENABLE([hpc],
[AS_HELP_STRING([--enable-hpc],
[Use HPC-optimized functions])],
[enable_hpc=$enableval],
[enable_hpc=no])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$enable_hpc" = "xyes"],
2022-09-22 13:37:29 +02:00
[AC_DEFINE([HAVE_HPC], [1], [Activate HPC routines])])
2021-05-07 12:47:56 +02:00
2023-06-29 15:56:11 +02:00
AC_ARG_ENABLE([fpe],
[AS_HELP_STRING([--enable-fpe],
[Enable floating-point exceptions])],
[enable_fpe=$enableval],
[enable_fpe=no])
AS_IF([test "x$enable_fpe" = "xyes"],
[AC_DEFINE([HAVE_FPE], [1], [Activate floating-point exceptions])])
2022-09-28 17:52:33 +02:00
AC_ARG_ENABLE([doc],
[AS_HELP_STRING([--disable-doc],
[Disable documentation])],
2022-10-13 15:49:45 +02:00
[enable_doc=$enableval],
2022-09-28 17:52:33 +02:00
[enable_doc=yes])
2022-09-28 17:58:50 +02:00
AM_CONDITIONAL([HAVE_DOC],[test "x$enable_doc" = "xyes"])
2022-09-28 17:52:33 +02:00
2022-10-13 15:49:45 +02:00
# Enable Verificarlo tests
AC_ARG_ENABLE([vfc_ci],
2022-09-22 13:37:29 +02:00
[AS_HELP_STRING([--enable-vfc_ci],
[Build the library with vfc_ci support])],
[enable_vfc_ci=$enableval],
[enable_vfc_ci=no])
AS_IF([test "x$enable_vfc_ci" = "xyes"],
[FCFLAGS="-D VFC_CI $FCFLAGS"
CFLAGS="-D VFC_CI $CFLAGS"
2022-09-28 17:52:33 +02:00
LIBS="$LIBS -lvfc_probes"])
2022-09-22 13:37:29 +02:00
AM_CONDITIONAL([VFC_CI], [test "x$vfc_ci" = "xtrue"])
2022-10-20 15:44:11 +02:00
AS_IF([test "$FC" = "verificarlo-f"], [
AC_MSG_NOTICE(verificarlo-f detected)
# Arguments order is important here
FCFLAGS="-Mpreprocess $FCFLAGS"
2022-10-20 15:44:11 +02:00
])
2022-05-06 11:29:46 +02:00
AC_ARG_ENABLE(malloc-trace, [AS_HELP_STRING([--enable-malloc-trace],[use debug malloc/free])], ok=$enableval, ok=no)
2022-10-06 22:39:35 +02:00
AS_IF([test "x$ok" = "xyes"], [
2022-05-06 11:29:46 +02:00
AC_DEFINE(MALLOC_TRACE,"malloc_trace.dat",[Define to use debugging malloc/free])
ARGS="${ARGS} malloc-trace"
2022-09-22 13:56:52 +02:00
])
2022-05-06 11:29:46 +02:00
AC_ARG_ENABLE(prof, [AS_HELP_STRING([--enable-prof],[compile for profiling])], ok=$enableval, ok=no)
2022-10-06 22:39:35 +02:00
AS_IF([test "x$ok" = "xyes"], [
2022-05-06 11:29:46 +02:00
CFLAGS="${CFLAGS} -pg"
AC_DEFINE(ENABLE_PROF,1,[Define when using the profiler tool])
ARGS="${ARGS} prof"
2022-09-22 13:56:52 +02:00
])
2022-05-06 11:29:46 +02:00
AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence],[use ElectricFence library])], ok=$withval, ok=no)
2022-10-06 22:39:35 +02:00
AS_IF([test "x$ok" = "xyes"], [
2022-05-06 11:29:46 +02:00
AC_CHECK_LIB([efence], [malloc])
ARGS="${ARGS} efence"
2022-09-22 13:56:52 +02:00
])
2022-05-06 11:29:46 +02:00
2024-12-13 03:00:01 +01:00
AC_ARG_ENABLE(sanitizer, [AS_HELP_STRING([--enable-sanitizer],[enable sanitizer debug flags])], ok=$enableval, ok=no)
if test "$ok" = "yes"; then
CFLAGS="${CFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
FCFLAGS="${FCFLAGS} -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=bounds -fsanitize=bounds-strict"
fi
##
2021-11-09 18:59:46 +01:00
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[compile for debugging])], ok=$enableval, ok=no)
2022-10-06 22:39:35 +02:00
AS_IF([test "x$ok" = "xyes"], [
AS_IF([test "x$GCC" = "xyes"], [
2022-10-06 10:22:59 +02:00
CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2"
2023-05-22 19:15:17 +02:00
CFLAGS="$CFLAGS -g \
-Wall -W -Wbad-function-cast -Wcast-qual -Warray-bounds -Wdisabled-optimization \
-fno-omit-frame-pointer -fstack-protector-strong -Wformat -Werror=format-security \
2022-02-17 16:08:22 +01:00
-Wpointer-arith -Wcast-align -Wpedantic -Wextra -Walloc-zero -Werror \
2022-02-16 15:14:41 +01:00
"
2023-05-22 19:15:17 +02:00
LDFLAGS="$LDFLAGS"
2022-09-22 13:56:52 +02:00
])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$GFC" = "xyes"], [
2021-05-07 13:16:46 +02:00
FCFLAGS="$FCFLAGS \
2022-02-19 19:24:18 +01:00
-g -fcheck=all -Waliasing -Wampersand -Wconversion \
2021-05-07 13:16:46 +02:00
-Wsurprising -ffpe-trap=zero,overflow,underflow \
-Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \
-Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan"
2022-09-22 13:56:52 +02:00
])
2022-10-06 22:39:35 +02:00
AS_IF([test "x$FC" = "xifort"], [
2021-05-07 13:16:46 +02:00
FCFLAGS="$FCFLAGS \
-traceback -check all -debug all -fpe-all=0 -implicitnone"
2022-09-22 13:56:52 +02:00
])
2021-05-07 13:16:46 +02:00
AC_DEFINE(DEBUG,1,[Define to turn on debugging checks])
2021-05-09 02:12:38 +02:00
ARGS="${ARGS} debug"
2022-09-22 13:56:52 +02:00
])
2021-05-07 12:47:56 +02:00
2021-05-07 13:16:46 +02:00
# Checks for header files.
## qmckl
AC_CHECK_HEADERS([inttypes.h malloc.h stdint.h stdlib.h string.h strings.h unistd.h])
2021-05-07 12:47:56 +02:00
# Checks for typedefs, structures, and compiler characteristics.
## qmckl
AC_CHECK_HEADER_STDBOOL
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
# Checks for library functions.
## qmckl
Integration of Verificarlo CI tests (#1) * comment * Update distance test code The distance test has been updated to the latest version, with a first attempt at using vfc_probes inside it * Functional implementation of vfc_probes in the distance tests This commit has the first functional vfc_ci tests. Verificarlo tests should be written over the existing tests, and they can be enabled with the following configure command: QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-maintainer-mode --enable-vfc_ci CC="verificarlo-f -Mpreprocess -D VFC_CI" FC="verificarlo-f -Mpreprocess -D VFC_CI" --host=x86_64 The --enable-vfc_ci flag will trigger the linking of the vfc_ci library. Moreover, as of now, the "-Mpreprocess" and "-D VFC_CI" flags have to be specified directly here. There is probably an appropriate macro to place those flags into but I couldn't find it yet, and could only manage to build the tests this way. When the VFC_CI preprocessor is defined, somme additional code to register and export the test probes can be executed (see qmckl_distance.org). As of now, the tests are built as normal, even though they are expected to fail : make all make check From there, the test_qmckl_distance (and potentially the others) executable can be called at will. This will typically be done automatically by vfc_ci, but one could manually execute the executable by defining the following env variables : VFC_PROBES_OUTPUT="test.csv" VFC_BACKENDS="libinterflop_ieee.so" depending on the export file and the Verificarlo backend to be used. The next steps will be to define more tests such as this one, and to integrate them into a Verificarlo CI workflow (by writing a vfc_tests_config.json file and using the automatic CI setup command). * Error in FOrtran interface fixed * Added missing Fortran interfaces * Modify distance test and install process integration All probes are now ignored using only the preprocessor (instead of checking for a facultative argument) in the distance test. Moreover,preprocessing can now be enabled correctly using FCFLAGS (the issue seemed to come from the order of the arguments passed to gfortran/verificarlo-f with the preprocessor arg having to come first). * Add vfc_probes to AO tests vfc_probes have been added to qmckl_ao.org in the same way as qmckl_distance.org, which means that it can be enabled or disabled at compile time using the --enable-vfc_ci option. qmckl_distance.org has been slightly modified with a better indentation, and configure.ac now adds the "-D VFC_CI" flag to CFLAGS when vfc_ci is enabled. Co-authored-by: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
2021-07-07 13:42:42 +02:00
# AC_FUNC_MALLOC
2021-05-07 12:47:56 +02:00
AC_CHECK_FUNCS([memset strerror])
2021-05-11 11:45:49 +02:00
# Development mode
2022-09-22 13:56:52 +02:00
QMCKL_DEVEL=
AS_IF([test "x$enable_maintainer_mode" = "xyes"],
[QMCKL_DEVEL=" -- Developer mode"])
2021-11-01 09:55:51 +01:00
2021-05-11 11:45:49 +02:00
AM_CONDITIONAL([QMCKL_DEVEL],[test "x$QMCKL_DEVEL" != x])
2021-05-07 12:47:56 +02:00
2022-10-13 15:49:45 +02:00
AC_ARG_ENABLE([python],
2023-01-25 11:02:36 +01:00
[AS_HELP_STRING([--enable-python],
[Enable building the Python binding])],
2022-10-13 15:49:45 +02:00
[enable_python=$enableval],
2023-01-25 11:02:36 +01:00
[enable_python=no])
2022-10-13 15:49:45 +02:00
AM_CONDITIONAL([HAVE_PYTHON],[test "x$enable_python" = "xyes"])
2022-09-22 13:56:52 +02:00
AS_IF([test "x${QMCKL_DEVEL}" != "x"], [
2021-05-10 23:56:26 +02:00
AC_PROG_AWK
2021-06-03 01:32:50 +02:00
AM_PATH_PYTHON
2021-05-10 23:56:26 +02:00
AC_CHECK_PROGS([EMACS],[emacs26 emacs],[no])
2022-09-22 13:37:29 +02:00
AS_IF([test "x${EMACS}" = "xno"],
[AC_MSG_ERROR([
2021-05-10 23:56:26 +02:00
--------------------------------------
Error: Emacs is required for org-mode.
--------------------------------------
2022-09-22 13:37:29 +02:00
])])
2021-05-10 23:56:26 +02:00
AC_CHECK_PROGS([HAS_CPPCHECK],[cppcheck],[no])
2022-09-22 13:37:29 +02:00
AS_IF([test "x${HAS_CPPCHECK}" != "xno"], [HAS_CPPCHECK=1])
2021-05-07 12:47:56 +02:00
2022-10-13 15:49:45 +02:00
AS_IF([test "x$enable_python" = "xyes"], [
AX_PKG_SWIG(4.0.0, [], AC_MSG_WARN([SWIG is required to build Python API.]) )
] )
2022-09-22 13:56:52 +02:00
])
2021-05-04 17:10:20 +02:00
2023-09-15 10:23:29 +02:00
# Checking SIMD
AC_MSG_CHECKING([for SIMD length])
SIMD_LENGTH=1
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[
int simd=1;
#if defined(__AVX512F__)
simd=8;
#elif defined(__AVX2__)
simd=4;
#elif defined(__AVX__)
simd=4;
#elif defined(__SSE2__)
simd=2;
#elif defined(__ARM_NEON__)
simd=2;
#endif
return simd;
])], [SIMD_LENGTH=1],
[ AS_CASE([$?],
[1], [SIMD_LENGTH=1],
[2], [SIMD_LENGTH=2],
[4], [SIMD_LENGTH=4],
[8], [SIMD_LENGTH=8],
[16], [SIMD_LENGTH=16],
[SIMD_LENGTH=1])],
[SIMD_LENGTH=1]
)
AC_MSG_RESULT([$SIMD_LENGTH])
AC_DEFINE_UNQUOTED([SIMD_LENGTH], [$SIMD_LENGTH], [Length of SIMD vectors])
# Checking IVDEP
ivdep=""
AC_MSG_CHECKING([for ivdep pragma])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma ivdep
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("ivdep")'], [
])
AS_IF([test "x$ivdep" = "x"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma clang loop vectorize(enable)
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("clang loop vectorize(enable)")'], [
])
])
AS_IF([test "x$ivdep" = "x"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[
int main() {
#pragma GCC ivdep
for (int i = 0; i < 10; ++i) {
printf("Testing: %d\n", i);
}
return 0;
}
]])],
[ivdep='_Pragma("GCC ivdep")'], [
])
])
AC_DEFINE_UNQUOTED([IVDEP], [$ivdep], [IVDEP pragma])
AS_IF([test "x$ivdep" = "x"], [
ivdep="no"
])
AC_MSG_RESULT([$ivdep])
# Checking ALIGNED
2023-10-06 11:33:33 +02:00
AC_MSG_CHECKING([for posix_memalign])
2023-09-15 10:23:29 +02:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2023-10-06 11:33:33 +02:00
#include <stdlib.h>
#include <stdio.h>
2023-09-15 10:23:29 +02:00
]], [[
int main() {
2023-10-06 11:33:33 +02:00
void *ptr;
int ret = posix_memalign(&ptr, 64, 1024);
if (ret != 0) {
return EXIT_FAILURE;
}
free(ptr);
return 0;
2023-09-15 10:23:29 +02:00
}
]])],
2023-10-06 11:33:33 +02:00
[have_posix_memalign=yes], [have_posix_memalign=no
2023-09-15 10:23:29 +02:00
])
2023-10-06 11:33:33 +02:00
AS_IF([test "x$have_posix_memalign" = "xyes"], [
AC_DEFINE([HAVE_POSIX_MEMALIGN], [1], [Define to 1 if you have the posix_memalign function.])
2023-09-15 10:23:29 +02:00
])
2023-10-06 11:33:33 +02:00
AC_MSG_RESULT([$have_posix_memalign])
2023-09-15 10:23:29 +02:00
aligned=""
AC_MSG_CHECKING([for vector aligned pragma])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
]], [[
int main() {
double __attribute__((aligned(8))) a[10] ;
#pragma vector aligned
for (int i = 0; i < 10; ++i) {
a[i] = (double) i;
}
return 0;
}
]])],
[aligned='_Pragma("vector aligned")'], [
])
2023-10-06 11:33:33 +02:00
AS_IF([test "x$have_posix_memalign" = "xno"], [
2023-09-15 10:23:29 +02:00
aligned=""
])
AC_DEFINE_UNQUOTED([ALIGNED], [$aligned], [VECTOR ALIGNED pragma])
AS_IF([test "x$aligned" = "x"], [
aligned="no"
])
AC_MSG_RESULT([$aligned])
Integration of Verificarlo CI tests (#1) * comment * Update distance test code The distance test has been updated to the latest version, with a first attempt at using vfc_probes inside it * Functional implementation of vfc_probes in the distance tests This commit has the first functional vfc_ci tests. Verificarlo tests should be written over the existing tests, and they can be enabled with the following configure command: QMCKL_DEVEL=1 ./configure --prefix=$PWD/_install --enable-maintainer-mode --enable-vfc_ci CC="verificarlo-f -Mpreprocess -D VFC_CI" FC="verificarlo-f -Mpreprocess -D VFC_CI" --host=x86_64 The --enable-vfc_ci flag will trigger the linking of the vfc_ci library. Moreover, as of now, the "-Mpreprocess" and "-D VFC_CI" flags have to be specified directly here. There is probably an appropriate macro to place those flags into but I couldn't find it yet, and could only manage to build the tests this way. When the VFC_CI preprocessor is defined, somme additional code to register and export the test probes can be executed (see qmckl_distance.org). As of now, the tests are built as normal, even though they are expected to fail : make all make check From there, the test_qmckl_distance (and potentially the others) executable can be called at will. This will typically be done automatically by vfc_ci, but one could manually execute the executable by defining the following env variables : VFC_PROBES_OUTPUT="test.csv" VFC_BACKENDS="libinterflop_ieee.so" depending on the export file and the Verificarlo backend to be used. The next steps will be to define more tests such as this one, and to integrate them into a Verificarlo CI workflow (by writing a vfc_tests_config.json file and using the automatic CI setup command). * Error in FOrtran interface fixed * Added missing Fortran interfaces * Modify distance test and install process integration All probes are now ignored using only the preprocessor (instead of checking for a facultative argument) in the distance test. Moreover,preprocessing can now be enabled correctly using FCFLAGS (the issue seemed to come from the order of the arguments passed to gfortran/verificarlo-f with the preprocessor arg having to come first). * Add vfc_probes to AO tests vfc_probes have been added to qmckl_ao.org in the same way as qmckl_distance.org, which means that it can be enabled or disabled at compile time using the --enable-vfc_ci option. qmckl_distance.org has been slightly modified with a better indentation, and configure.ac now adds the "-D VFC_CI" flag to CFLAGS when vfc_ci is enabled. Co-authored-by: Anthony Scemama <scemama@irsamc.ups-tlse.fr>
2021-07-07 13:42:42 +02:00
2021-05-07 12:47:56 +02:00
#PKG-CONFIG
#mkl-dynamic-lp64-seq
2021-05-04 17:10:20 +02:00
2021-10-06 13:01:11 +02:00
PKG_LIBS="$PKG_LIBS $LIBS"
LIBS="$BLAS_LIBS $LAPACK_LIBS $PKG_LIBS"
2021-10-06 13:01:11 +02:00
CFLAGS="$CFLAGS $PKG_CFLAGS"
2022-09-22 16:43:57 +02:00
PKG_LIBS="$PKG_LIBS $PKG_LIBS2"
PKG_CFLAGS="$PKG_CFLAGS $PKG_CFLAGS2"
2021-05-07 12:47:56 +02:00
AC_SUBST([PKG_LIBS])
AC_SUBST([PKG_CFLAGS])
2021-06-03 01:32:50 +02:00
AC_SUBST([HAS_CPPCHECK])
2021-05-04 17:10:20 +02:00
2021-05-07 12:47:56 +02:00
AC_CONFIG_FILES([Makefile
2021-05-12 00:22:51 +02:00
pkgconfig/qmckl.pc
2021-05-11 11:45:49 +02:00
])
2021-05-04 17:10:20 +02:00
AC_OUTPUT
2021-05-09 01:07:17 +02:00
echo \
"-------------------------------------------------
2021-05-12 23:18:22 +02:00
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${QMCKL_DEVEL}
2021-05-09 01:07:17 +02:00
Prefix: '${prefix}'.
CC..............: ${CC}
CFLAGS..........: ${CFLAGS}
2022-10-07 09:36:06 +02:00
CPPFLAGS........: ${CPPFLAGS}
FC..............: ${FC}
2022-04-04 12:11:26 +02:00
FCFLAGS.........: ${FCFLAGS}
2022-10-07 09:36:06 +02:00
HPC version.....: ${HAVE_HPC}
LDFLAGS:........: ${LDFLAGS}
LIBS............: ${LIBS}
2022-10-07 09:36:06 +02:00
OPENMP..........: ${with_omp}
2022-10-13 15:49:45 +02:00
PYTHON..........: ${enable_python}
2022-09-22 13:37:29 +02:00
QMCKL_DGEMM.....: ${with_qmckldgemm}
2022-10-07 09:36:06 +02:00
TREXIO..........: ${with_trexio}
2021-05-09 01:07:17 +02:00
Package features:
2021-05-09 02:12:38 +02:00
${ARGS}
2021-05-09 01:07:17 +02:00
Now type 'make @<:@<target>@:>@'
where the optional <target> is:
all - build the library
check - run tests
install - install ${PACKAGE_NAME}
--------------------------------------------------"