Skip to content
Snippets Groups Projects
Commit 0b43edac authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Customize MAGMA version

parent 34aeefdf
No related branches found
No related tags found
No related merge requests found
......@@ -463,6 +463,7 @@ ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_ILP64 = @ENABLE_ILP64@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
F77 = @F77@
......
......@@ -668,6 +668,7 @@ OMPFLAGS
OFFLOADFLAGS
BUILDFORTRAN_FALSE
BUILDFORTRAN_TRUE
ENABLE_ILP64
HDF5_LDFLAGS
CXXCPP
LT_SYS_LIBRARY_PATH
......@@ -812,6 +813,7 @@ with_aix_soname
with_gnu_ld
with_sysroot
enable_libtool_lock
enable_ilp64
enable_fortran
enable_offload
enable_openmp
......@@ -1477,6 +1479,7 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-ilp64 enable 64-bit indexing [default=yes]
--enable-fortran enable legacy FORTRAN compilation [default=auto]
--enable-offload enable target offloading (requires g++ version >=
13) [default=auto]
......@@ -1496,7 +1499,8 @@ Optional Packages:
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--with-lapack use LAPACK [default=auto]
--with-magma use MAGMA [default=auto]
--with-magma[=MAGMA_DIR]
use MAGMA [default=auto]
--with-include additional include folders [default=none]
--with-fflags=flags FORTRAN compiler flags [default="-std=legacy -O3"]
--with-ldflags=flags custom linker flags [default=none]
......@@ -24829,6 +24833,30 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
# Environment setup
 
if test "x${HDF5_INCLUDE}${HDF5_LIB}" = "x"; then
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
declare -a pkg_array=$(pkg-config --list-all | grep hdf5-serial)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep hdf5-serial > /dev/null
result=$?
if test "x$result" = "x0"; then
cflags=$(pkg-config --cflags-only-I hdf5-serial)
export HDF5_INCLUDE=$(echo "${cflags:2}")
ldflags=$(pkg-config --libs-only-L hdf5-serial)
export HDF5_LIB=$(echo "${ldflags:2}")
else
declare -a pkg_array=$(pkg-config --list-all | grep hdf5)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep hdf5 > /dev/null
result=$?
if test "x$result" = "x0"; then
cflags=$(pkg-config --cflags-only-I hdf5)
export HDF5_INCLUDE=$(echo "${cflags:2}")
ldflags=$(pkg-config --libs-only-L hdf5)
export HDF5_LIB=$(echo "${ldflags:2}")
fi
fi
else
export -p | grep HDF5_ROOT > /dev/null
result=$?
if test "x$result" = "x0"; then
......@@ -24855,16 +24883,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "x$HDF5_LIB" = "x"; then
export HDF5_LIB="/usr/lib/x86_64-linux-gnu/hdf5/serial"
fi
fi
fi
 
 
 
# Check for required headers
# AC_CHECK_HEADER(
# [${HDF5_INCLUDE}/hdf5.h],
# ,
# AC_MSG_ERROR([Could not find HDF5 headers!]),
# )
if test -f ${HDF5_INCLUDE}/hdf5.h
if test "x${HDF5_INCLUDE}" != "x"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: HDF5 headers found in ${HDF5_INCLUDE}" >&5
printf "%s\n" "$as_me: HDF5 headers found in ${HDF5_INCLUDE}" >&6;}
......@@ -24873,6 +24897,15 @@ else case e in #(
;;
esac
fi
if test "x${HDF5_LIB}" != "x"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: HDF5 libraries found in ${HDF5_LIB}" >&5
printf "%s\n" "$as_me: HDF5 libraries found in ${HDF5_LIB}" >&6;}
else case e in #(
e) as_fn_error $? "HDF5 libraries not found!" "$LINENO" 5
;;
esac
fi
 
# Check for required libraries
 
......@@ -24897,12 +24930,34 @@ then :
HDF5_LDFLAGS="-L${HDF5_LIB} -lhdf5"
 
else case e in #(
e) as_fn_error $? "\"HDF5 library not found!\"" "$LINENO" 5
e) as_fn_error $? "\"HDF5 library not working!\"" "$LINENO" 5
;;
esac
fi
 
# Configure the optional features
# Check whether --enable-ilp64 was given.
if test ${enable_ilp64+y}
then :
enableval=$enable_ilp64;
if test "x$enableval" = "xno"; then
ENABLE_ILP64=""
else
ENABLE_ILP64="yes"
fi
else case e in #(
e)
ENABLE_ILP64="yes"
;;
esac
fi
# Check whether --enable-fortran was given.
if test ${enable_fortran+y}
then :
......@@ -25114,15 +25169,67 @@ then :
 
else
 
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
LAPACK_ILP64_LDSPEC="_ilp64"
LAPACK_LDSPEC="64"
MKL_BUILD="mkl-dynamic-ilp64-gomp"
else
# 64-bit indices are disabled
LAPACK_ILP64_FLAG=""
LAPACK_ILP64_LDSPEC="_lp64"
LAPACK_LDSPEC=""
MKL_BUILD="mkl-dynamic-lp64-gomp"
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep ${MKL_BUILD})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep ${MKL_BUILD} > /dev/null
result=$?
if test "x$result" = "x0"; then
# MKL was found
MKL_INCLUDE=$(pkg-config --cflags-only-I ${MKL_BUILD})
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs ${MKL_BUILD})
else
# MKL was not found, so configuration searches for LAPACKe
declare -a pkg_array=$(pkg-config --list-all | grep lapacke${LAPACK_LDSPEC})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapacke${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACKe was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapacke${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapacke${LAPACK_LDSPEC})
fi # end of LAPACKe decision tree
if test "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x"; then
# LAPACKe was not found, so configuration searches for LAPACK
declare -a pkg_array=$(pkg-config --list-all | grep lapack${LAPACK_LDSPEC})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapack${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACK was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapack${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapack${LAPACK_LDSPEC})
fi # end of LAPACK decision tree
fi # end of LAPACKe decision tree
fi # end of MKL decision tree
else
# pkg-config is not available
export -p | grep MKL > /dev/null
MKL_DEF=$?
if test "x$MKL_DEF" = "x0"; then
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel${LAPACK_ILP64_LDSPEC} -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
else
if test -f /usr/include/lapacke.h; then
export LAPACKFLAGS="-DUSE_LAPACK -DLAPACK_ILP64 -DUSE_ILP64"
export LAPACKLDFLAGS="-llapacke64"
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG}"
export LAPACKLDFLAGS="-llapacke${LAPACK_LDSPEC}"
fi
fi
fi
 
......@@ -25146,15 +25253,67 @@ fi
else case e in #(
e)
 
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
LAPACK_ILP64_LDSPEC="_ilp64"
LAPACK_LDSPEC="64"
MKL_BUILD="mkl-dynamic-ilp64-gomp"
else
# 64-bit indices are disabled
LAPACK_ILP64_FLAG=""
LAPACK_ILP64_LDSPEC="_lp64"
LAPACK_LDSPEC=""
MKL_BUILD="mkl-dynamic-lp64-gomp"
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep ${MKL_BUILD})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep ${MKL_BUILD} > /dev/null
result=$?
if test "x$result" = "x0"; then
# MKL was found
MKL_INCLUDE=$(pkg-config --cflags-only-I ${MKL_BUILD})
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs ${MKL_BUILD})
else
# MKL was not found, so configuration searches for LAPACKe
declare -a pkg_array=$(pkg-config --list-all | grep lapacke${LAPACK_LDSPEC})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapacke${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACKe was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapacke${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapacke${LAPACK_LDSPEC})
fi # end of LAPACKe decision tree
if test "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x"; then
# LAPACKe was not found, so configuration searches for LAPACK
declare -a pkg_array=$(pkg-config --list-all | grep lapack${LAPACK_LDSPEC})
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapack${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACK was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapack${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapack${LAPACK_LDSPEC})
fi # end of LAPACK decision tree
fi # end of LAPACKe decision tree
fi # end of MKL decision tree
else
# pkg-config is not available
export -p | grep MKL > /dev/null
MKL_DEF=$?
if test "x$MKL_DEF" = "x0"; then
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel${LAPACK_ILP64_LDSPEC} -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
else
if test -f /usr/include/lapacke.h; then
export LAPACKFLAGS="-DUSE_LAPACK -DLAPACK_ILP64 -DUSE_ILP64"
export LAPACKLDFLAGS="-llapacke64"
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG}"
export LAPACKLDFLAGS="-llapacke${LAPACK_LDSPEC}"
fi
fi
fi
 
......@@ -25190,10 +25349,36 @@ then :
MAGMALDFLAGS=""
 
else
if test "x$withval" != "xyes" and "x$withval" != "xauto"; then
if test "x$withval" != "xyes"; then
if test "x$withval" != "xauto"; then
export MAGMA_HOME=$withval
fi
fi
 
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
MAGMA_ILP64_FLAG="-DMAGMA_ILP64"
MAGMA_LD_SPEC="64"
else
# 64-bit indices are disabled
MAGMA_ILP64_FLAG=""
MAGMA_LD_SPEC=""
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep cudart)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
result=$?
if test "x$result" = "x0"; then
# CUDA runtime detected
cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
fi # end of CUDA runtime decision tree
else
# pkg-config is not available
if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
......@@ -25204,21 +25389,44 @@ then :
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
result=$?
if test "x$result" = "x0"; then
# MAGMA was found
magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree
else
# search for MAGMA in some standard folders
if test "x$CUDAFLAGS" != "x"; then
if test -f /usr/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test -f /usr/local/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/local/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/local/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test "x$MAGMA_HOME" != "x"; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
elif test "x$MAGMA_ROOT" != "x"; then
fi
fi
fi # end of pkg-config decision tree
else
# MAGMA environment is defined, so configuration makes sure that MAGMA_ROOT is defined too
if test "x${MAGMA_HOME}" != "x"; then
MAGMA_ROOT="${MAGMA_HOME}"
elif test "x${MAGMA_DIR}" != "x"; then
MAGMA_ROOT="${MAGMA_DIR}"
fi
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
fi
fi
 
 
if test "x$MAGMALDFLAGS" != "x"
......@@ -25240,6 +25448,30 @@ fi
else case e in #(
e)
 
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
MAGMA_ILP64_FLAG="-DMAGMA_ILP64"
MAGMA_LD_SPEC="64"
else
# 64-bit indices are disabled
MAGMA_ILP64_FLAG=""
MAGMA_LD_SPEC=""
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep cudart)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
result=$?
if test "x$result" = "x0"; then
# CUDA runtime detected
cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
fi # end of CUDA runtime decision tree
else
# pkg-config is not available
if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
......@@ -25250,21 +25482,44 @@ else case e in #(
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
result=$?
if test "x$result" = "x0"; then
# MAGMA was found
magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree
else
# search for MAGMA in some standard folders
if test "x$CUDAFLAGS" != "x"; then
if test -f /usr/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test -f /usr/local/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/local/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/local/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test "x$MAGMA_HOME" != "x"; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
elif test "x$MAGMA_ROOT" != "x"; then
fi
fi
fi # end of pkg-config decision tree
else
# MAGMA environment is defined, so configuration makes sure that MAGMA_ROOT is defined too
if test "x${MAGMA_HOME}" != "x"; then
MAGMA_ROOT="${MAGMA_HOME}"
elif test "x${MAGMA_DIR}" != "x"; then
MAGMA_ROOT="${MAGMA_DIR}"
fi
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
fi
fi
 
 
if test "x$MAGMALDFLAGS" != "x"
......
# CAPABILITY TESTING MACROS
m4_define(
[M4_HDF5_LIB],
[
cat > nptm_test_hdf5.cpp <<EOF
#include <hdf5.h>
int main(int argc, char **argv) {
hid_t file_id = 0;
herr_t status = H5Iis_valid(file_id);
return (int)status;
}
EOF
$CXX -o nptm_test_hdf5 nptm_test_hdf5.cpp -I$HDF5_INCLUDE -L$HDF5_LIB -lhdf5 > /dev/null 2>>error.log
export TEST_HDF5_LIB=$?
rm nptm_test_hdf5.cpp
if test "x$TEST_HDF5_LIB" = "x0"; then
rm nptm_test_hdf5
fi
]
)
m4_define(
[M4_DETECT_HDF5],
[
if test "x${HDF5_INCLUDE}${HDF5_LIB}" = "x"; then
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
declare -a pkg_array=$(pkg-config --list-all | grep hdf5-serial)
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep hdf5-serial > /dev/null
result=$?
if test "x$result" = "x0"; then
cflags=$(pkg-config --cflags-only-I hdf5-serial)
export HDF5_INCLUDE=$(echo "${cflags:2}")
ldflags=$(pkg-config --libs-only-L hdf5-serial)
export HDF5_LIB=$(echo "${ldflags:2}")
else
declare -a pkg_array=$(pkg-config --list-all | grep hdf5)
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep hdf5 > /dev/null
result=$?
if test "x$result" = "x0"; then
cflags=$(pkg-config --cflags-only-I hdf5)
export HDF5_INCLUDE=$(echo "${cflags:2}")
ldflags=$(pkg-config --libs-only-L hdf5)
export HDF5_LIB=$(echo "${ldflags:2}")
fi
fi
else
export -p | grep HDF5_ROOT > /dev/null
result=$?
if test "x$result" = "x0"; then
......@@ -48,21 +52,95 @@ m4_define(
if test "x$HDF5_LIB" = "x"; then
export HDF5_LIB="/usr/lib/x86_64-linux-gnu/hdf5/serial"
fi
fi
fi
]
)
m4_define(
[M4_HDF5_LIB],
[
cat > nptm_test_hdf5.cpp <<EOF
#include <hdf5.h>
int main(int argc, char **argv) {
hid_t file_id = 0;
herr_t status = H5Iis_valid(file_id);
return (int)status;
}
EOF
$CXX -o nptm_test_hdf5 nptm_test_hdf5.cpp -I$HDF5_INCLUDE -L$HDF5_LIB -lhdf5 > /dev/null 2>>error.log
export TEST_HDF5_LIB=$?
rm nptm_test_hdf5.cpp
if test "x$TEST_HDF5_LIB" = "x0"; then
rm nptm_test_hdf5
fi
]
)
m4_define(
[M4_DETECT_LAPACK],
[
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
LAPACK_ILP64_LDSPEC="_ilp64"
LAPACK_LDSPEC="64"
MKL_BUILD="mkl-dynamic-ilp64-gomp"
else
# 64-bit indices are disabled
LAPACK_ILP64_FLAG=""
LAPACK_ILP64_LDSPEC="_lp64"
LAPACK_LDSPEC=""
MKL_BUILD="mkl-dynamic-lp64-gomp"
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep ${MKL_BUILD})
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep ${MKL_BUILD} > /dev/null
result=$?
if test "x$result" = "x0"; then
# MKL was found
MKL_INCLUDE=$(pkg-config --cflags-only-I ${MKL_BUILD})
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs ${MKL_BUILD})
else
# MKL was not found, so configuration searches for LAPACKe
declare -a pkg_array=$(pkg-config --list-all | grep lapacke${LAPACK_LDSPEC})
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapacke${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACKe was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapacke${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapacke${LAPACK_LDSPEC})
fi # end of LAPACKe decision tree
if test "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x"; then
# LAPACKe was not found, so configuration searches for LAPACK
declare -a pkg_array=$(pkg-config --list-all | grep lapack${LAPACK_LDSPEC})
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep lapack${LAPACK_LDSPEC} > /dev/null
result=$?
if test "x$result" = "x0"; then
# LAPACK was found
LAPACK_INCLUDE=$(pkg-config --cflags-only-I lapack${LAPACK_LDSPEC})
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE}"
export LAPACKLDFLAGS=$(pkg-config --libs lapack${LAPACK_LDSPEC})
fi # end of LAPACK decision tree
fi # end of LAPACKe decision tree
fi # end of MKL decision tree
else
# pkg-config is not available
export -p | grep MKL > /dev/null
MKL_DEF=$?
if test "x$MKL_DEF" = "x0"; then
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL -DLAPACK_ILP64 -DUSE_ILP64 -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
export LAPACKFLAGS="-DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} -I{MKLROOT}/include"
export LAPACKLDFLAGS="-L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel${LAPACK_ILP64_LDSPEC} -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
else
if test -f /usr/include/lapacke.h; then
export LAPACKFLAGS="-DUSE_LAPACK -DLAPACK_ILP64 -DUSE_ILP64"
export LAPACKLDFLAGS="-llapacke64"
export LAPACKFLAGS="-DUSE_LAPACK ${LAPACK_ILP64_FLAG}"
export LAPACKLDFLAGS="-llapacke${LAPACK_LDSPEC}"
fi
fi
fi
]
......@@ -71,6 +149,30 @@ m4_define(
m4_define(
[M4_DETECT_MAGMA],
[
if test "x$ENABLE_ILP64" = "xyes"; then
# 64-bit indices are enabled
MAGMA_ILP64_FLAG="-DMAGMA_ILP64"
MAGMA_LD_SPEC="64"
else
# 64-bit indices are disabled
MAGMA_ILP64_FLAG=""
MAGMA_LD_SPEC=""
fi # end of 64-bit decision tree
pkg-config --version > /dev/null
use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then
# pkg-config is available
declare -a pkg_array=$(pkg-config --list-all | grep cudart)
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
result=$?
if test "x$result" = "x0"; then
# CUDA runtime detected
cuda_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
fi # end of CUDA runtime decision tree
else
# pkg-config is not available
if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
......@@ -81,21 +183,44 @@ m4_define(
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
result=$?
if test "x$result" = "x0"; then
# MAGMA was found
magma_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree
else
# search for MAGMA in some standard folders
if test "x$CUDAFLAGS" != "x"; then
if test -f /usr/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test -f /usr/local/include/magma_v2.h; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I/usr/local/include"
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS -I/usr/local/include"
export MAGMALDFLAGS="$CUDALDFLAGS -lmagma"
elif test "x$MAGMA_HOME" != "x"; then
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_HOME}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_HOME}/lib -lmagma"
elif test "x$MAGMA_ROOT" != "x"; then
fi
fi
fi # end of pkg-config decision tree
else
# MAGMA environment is defined, so configuration makes sure that MAGMA_ROOT is defined too
if test "x${MAGMA_HOME}" != "x"; then
MAGMA_ROOT="${MAGMA_HOME}"
elif test "x${MAGMA_DIR}" != "x"; then
MAGMA_ROOT="${MAGMA_DIR}"
fi
export MAGMAFLAGS="-DUSE_MAGMA -DMAGMA_ILP64 $CUDAFLAGS -I${MAGMA_ROOT}/include"
export MAGMALDFLAGS="$CUDALDFLAGS -L${MAGMA_ROOT}/lib -lmagma"
fi
fi
]
)
......@@ -253,27 +378,41 @@ LT_INIT
# Environment setup
M4_DETECT_HDF5
# Check for required headers
# AC_CHECK_HEADER(
# [${HDF5_INCLUDE}/hdf5.h],
# ,
# AC_MSG_ERROR([Could not find HDF5 headers!]),
# )
AS_IF(
[test -f ${HDF5_INCLUDE}/hdf5.h],
[test "x${HDF5_INCLUDE}" != "x"],
[AC_MSG_NOTICE([HDF5 headers found in ${HDF5_INCLUDE}])],
[AC_MSG_ERROR([HDF5 headers not found!])]
)
AS_IF(
[test "x${HDF5_LIB}" != "x"],
[AC_MSG_NOTICE([HDF5 libraries found in ${HDF5_LIB}])],
[AC_MSG_ERROR([HDF5 libraries not found!])]
)
# Check for required libraries
M4_HDF5_LIB
AS_IF(
[test "x$TEST_HDF5_LIB" = "x0"],
[AC_SUBST([HDF5_LDFLAGS], ["-L${HDF5_LIB} -lhdf5"])],
[AC_MSG_ERROR(["HDF5 library not found!"])]
[AC_MSG_ERROR(["HDF5 library not working!"])]
)
# Configure the optional features
AC_ARG_ENABLE(
[ilp64],
[AS_HELP_STRING([--enable-ilp64], [enable 64-bit indexing [default=yes]])],
[
if test "x$enableval" = "xno"; then
AC_SUBST([ENABLE_ILP64], [""])
else
AC_SUBST([ENABLE_ILP64], ["yes"])
fi
],
[
AC_SUBST([ENABLE_ILP64], ["yes"])
]
)
AC_ARG_ENABLE(
[fortran],
[AS_HELP_STRING([--enable-fortran], [enable legacy FORTRAN compilation [default=auto]])],
......@@ -403,15 +542,17 @@ AC_ARG_WITH(
AC_ARG_WITH(
[magma],
[AS_HELP_STRING([--with-magma], [use MAGMA @<:@default=auto@:>@])],
[AS_HELP_STRING([--with-magma[[=MAGMA_DIR]]], [use MAGMA @<:@default=auto@:>@])],
[
if test "x$withval" = "xno"; then
AC_SUBST([MAGMAFLAGS], [""])
AC_SUBST([MAGMALDFLAGS], [""])
else
if test "x$withval" != "xyes" and "x$withval" != "xauto"; then
if test "x$withval" != "xyes"; then
if test "x$withval" != "xauto"; then
export MAGMA_HOME=$withval
fi
fi
M4_DETECT_MAGMA
AS_IF(
[test "x$MAGMALDFLAGS" != "x"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment