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

Enable LAPACK detection configuration

parent bfde602f
No related branches found
No related tags found
No related merge requests found
AUTOMAKE_OPTIONS=subdir-objects AUTOMAKE_OPTIONS=subdir-objects
LDADD=libnptm/libnptm.la -L/usr/lib64 $(HDF5_LDFLAGS) LDADD=libnptm/libnptm.la -L/usr/lib64 ${HDF5_LDFLAGS} ${LAPACK_LDFLAGS}
lib_LTLIBRARIES=libnptm/libnptm.la lib_LTLIBRARIES=libnptm/libnptm.la
libnptm_libnptm_la_SOURCES=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/file_io.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/logging.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/types.cpp libnptm_libnptm_la_SOURCES=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/file_io.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/logging.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/types.cpp
bin_PROGRAMS=cluster/edfb_clu cluster/clu cluster/np_cluster sphere/edfb_sph sphere/sph sphere/np_sphere trapping/frfme trapping/lffft trapping/np_trapping bin_PROGRAMS=cluster/edfb_clu cluster/clu cluster/np_cluster sphere/edfb_sph sphere/sph sphere/np_sphere trapping/frfme trapping/lffft trapping/np_trapping
......
# CAPABILITY TESTING MACROS # CAPABILITY TESTING MACROS
m4_define( m4_define(
[M4_HDF5_LIB], [M4_HDF5_LIB],
[cat > nptm_test_hdf5.cpp <<EOF [
cat > nptm_test_hdf5.cpp <<EOF
#include <hdf5.h> #include <hdf5.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
hid_t file_id = 0; hid_t file_id = 0;
...@@ -9,14 +10,30 @@ int main(int argc, char **argv) { ...@@ -9,14 +10,30 @@ int main(int argc, char **argv) {
return (int)status; return (int)status;
} }
EOF EOF
$CXX -o nptm_test_hdf5 nptm_test_hdf5.cpp -I$HDF5_INCLUDE -L$HDF5_LIB -lhdf5 > /dev/null 2>>error.log $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=$? export TEST_HDF5_LIB=$?
rm nptm_test_hdf5.cpp rm nptm_test_hdf5.cpp
if test "x$TEST_HDF5_LIB" = "x0"; then if test "x$TEST_HDF5_LIB" = "x0"; then
rm nptm_test_hdf5 rm nptm_test_hdf5
fi] fi
]
)
m4_define(
[M4_DETECT_LAPACK],
[
LAPACK_ROOT=$MKLROOT
if test "x$LAPACK_ROOT" != "x"; then
export LAPACK_INCLUDE=$(MKLROOT)/include
export LAPACK_LIB=$(MKLROOT)/lib
export LAPACK_LIBRARY="-Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
else
export LAPACK_INCLUDE=/usr/include
export LAPACK_LIB=/lib/x86_64-linux-gnu
export LAPACK_LIBRARY="-llapacke64"
fi
]
) )
# END CAPABILITY TESTING MACROS # END CAPABILITY TESTING MACROS
# autoconf setup initialization # autoconf setup initialization
...@@ -34,130 +51,191 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign]) ...@@ -34,130 +51,191 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Compiler detection # Compiler detection
AM_PROG_AR AM_PROG_AR
AC_ARG_ENABLE( AC_ARG_ENABLE(
[mpi], [mpi],
[AS_HELP_STRING([--enable-mpi], [use MPI if available (default is yes)])], [AS_HELP_STRING([--enable-mpi], [use MPI if available [default=yes]])],
[ [
if test "x$enableval" = "xno"; then if test "x$enableval" = "xno"; then
if test "x$F77" = "xmpif90"; then if test "x$F77" = "xmpif90"; then
gfortran --version > /dev/null gfortran --version > /dev/null
if test "x$?" = "x0"; then if test "x$?" = "x0"; then
export F77=gfortran AC_SUBST([F77], [gfortran])
fi fi
fi fi
if test "x$F77" = "xmpif90"; then if test "x$F77" = "xmpif90"; then
f77 --version > /dev/null f77 --version > /dev/null
if test "x$?" = "x0"; then if test "x$?" = "x0"; then
export F77=f77 #export F77=f77
fi AC_SUBST([F77], [f77])
fi fi
if test "x$CXX" = "xmpicxx"; then fi
g++ --version > /dev/null if test "x$CXX" = "xmpicxx"; then
if test "x$?" = "x0"; then g++ --version > /dev/null
export CXX=g++ if test "x$?" = "x0"; then
fi #export CXX=g++
fi AC_SUBST([CXX], [g++])
if test "x$CXX" = "xmpicxx"; then fi
clang --version > /dev/null fi
if test "x$?" = "x0"; then if test "x$CXX" = "xmpicxx"; then
export CXX=clang clang --version > /dev/null
fi if test "x$?" = "x0"; then
fi #export CXX=clang
if test "x$F77" = "x"; then AC_SUBST([CXX], [clang])
gfortran --version > /dev/null fi
if test "x$?" = "x0"; then fi
export F77=gfortran if test "x$F77" = "x"; then
fi gfortran --version > /dev/null
fi if test "x$?" = "x0"; then
if test "x$F77" = "x"; then #export F77=gfortran
f77 --version > /dev/null AC_SUBST([F77], [gfortran])
if test "x$?" = "x0"; then fi
export F77=f77 fi
fi if test "x$F77" = "x"; then
fi f77 --version > /dev/null
if test "x$CXX" = "x"; then if test "x$?" = "x0"; then
g++ --version > /dev/null #export F77=f77
if test "x$?" = "x0"; then AC_SUBST([F77], [f77])
export CXX=g++ fi
fi fi
fi if test "x$CXX" = "x"; then
if test "x$CXX" = "x"; then g++ --version > /dev/null
clang --version > /dev/null if test "x$?" = "x0"; then
if test "x$?" = "x0"; then #export CXX=g++
export CXX=clang AC_SUBST([CXX], [g++])
fi fi
fi fi
else if test "x$CXX" = "x"; then
mpicxx --version > /dev/null clang --version > /dev/null
if test "x$?" = "x0"; then if test "x$?" = "x0"; then
export CXX=mpicxx #export CXX=clang
export F77=mpif90 AC_SUBST([CXX], [clang])
else fi
AC_MSG_ERROR(["MPI was enabled, but no MPI compiler was found!"]) fi
fi else
fi mpicxx --version > /dev/null
], if test "x$?" = "x0"; then
[ #export CXX=mpicxx
if test "x$CXX" = "x"; then #export F77=mpif90
mpicxx --version > /dev/null AC_SUBST([CXX], [mpicxx])
if test "x$?" = "x0"; then AC_SUBST([F77], [mpif90])
export CXX=mpicxx else
export F77=mpif90 AC_MSG_ERROR(["MPI was enabled, but no MPI compiler was found!"])
fi fi
fi fi
if test "x$CXX" = "x"; then ],
g++ --version > /dev/null [
if test "x$?" = "x0"; then if test "x$CXX" = "x"; then
export CXX=g++ mpicxx --version > /dev/null
fi if test "x$?" = "x0"; then
fi #export CXX=mpicxx
if test "x$CXX" = "x"; then #export F77=mpif90
clang --version > /dev/null AC_SUBST([CXX], [mpicxx])
if test "x$?" = "x0"; then AC_SUBST([F77], [mpif90])
export CXX=clang fi
fi fi
fi if test "x$CXX" = "x"; then
] g++ --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=g++
AC_SUBST([CXX], [g++])
fi
fi
if test "x$CXX" = "x"; then
clang --version > /dev/null
if test "x$?" = "x0"; then
#export CXX=clang
AC_SUBST([CXX], [clang])
fi
fi
]
) )
AC_SUBST([CXX]) AC_PROG_CXX([$CXX])
AC_PROG_CXX(CXX) AC_PROG_F77([$F77])
AC_SUBST([F77])
AC_PROG_F77([$F77 mpif90 gfortran f77])
# Libtool initialization # Libtool initialization
LT_INIT LT_INIT
# Environment setup # Environment setup
AS_IF( AS_IF(
[test "x$HDF5_INCLUDE" = "x"], [test "x$HDF5_INCLUDE" = "x"],
[export HDF5_INCLUDE=/usr/include/hdf5/serial], [AC_SUBST([HDF5_INCLUDE], ["/usr/include/hdf5/serial"])],
[AC_MSG_NOTICE(["HDF5_INCLUDE=$HDF5_INCLUDE"])] [AC_MSG_NOTICE([HDF5_INCLUDE=$(HDF5_INCLUDE)])]
) )
AS_IF( AS_IF(
[test "x$HDF5_LIB" = "x"], [test "x$HDF5_LIB" = "x"],
[export HDF5_LIB=/usr/lib/x86_64-linux-gnu/hdf5/serial], [AC_SUBST([HDF5_LIB], ["/usr/lib/x86_64-linux-gnu/hdf5/serial"])],
[AC_MSG_NOTICE(["HDF5_LIB=$HDF5_LIB"])] [AC_MSG_NOTICE([HDF5_LIB=$(HDF5_LIB)])]
) )
FFLAGS="-std=legacy -O3"
CXXFLAGS="-O3 -ggdb -Wno-format-contains-nul -I $HDF5_INCLUDE"
SUBDIRS="cluster libnptm sphere testing trapping"
# Check for required headers # Check for required headers
AC_CHECK_HEADER( AC_CHECK_HEADER(
[$HDF5_INCLUDE/hdf5.h], [$HDF5_INCLUDE/hdf5.h],
, ,
AC_MSG_ERROR(["Could not find HDF5 headers!]), AC_MSG_ERROR(["Could not find HDF5 headers!]),
) )
# Check for required libraries # Check for required libraries
M4_HDF5_LIB M4_HDF5_LIB
AS_IF( AS_IF(
[test "x$TEST_HDF5_LIB" = "x0"], [test "x$TEST_HDF5_LIB" = "x0"],
[export HDF5_LDFLAGS="-L${HDF5_LIB} -lhdf5"], [AC_SUBST([HDF5_LDFLAGS], ["-L${HDF5_LIB} -lhdf5"])],
[AC_MSG_ERROR(["HDF5 library not found!"])] [AC_MSG_ERROR(["HDF5 library not found!"])]
) )
AC_SUBST([HDF5_LDFLAGS])
# Configure the optional features # Configure the optional features
M4_DETECT_LAPACK
AS_IF(
[test "x$LAPACK_LIBRARY" != "x"],
[AC_MSG_NOTICE([LAPACK detected])],
[AC_MSG_NOTICE([No LAPACK found])]
)
AC_ARG_ENABLE(
[openmp],
[AS_HELP_STRING([--enable-openmp], [enable OpneMP multi-threading [default=yes]])],
[
if test "x$enableval" != "xno"; then
AC_SUBST([OMPFLAGS], ["-fopenmp"])
fi
],
[
AC_SUBST([OMPFLAGS], ["-fopenmp"])
]
)
AC_ARG_WITH(
[lapack],
[AS_HELP_STRING([--with-lapack], [use LAPACK @<:@default=check@:>@])],
[
if test "x$withval" = "xno"; then
AC_SUBST([LAPACK_FLAGS], [""])
AC_SUBST([LAPACK_LDFLAGS], [""])
fi
],
[
if test "x$LAPACK_INCLUDE" != "x"; then
AC_SUBST([LAPACK_FLAGS], ["-DUSE_LAPACK -DLAPACK_ILP64 -DUSE_ILP64 -I${LAPACK_INCLUDE}"])
AC_SUBST([LAPACK_LDFLAGS], ["-L${LAPACK_LIB} ${LAPACK_LIBRARY}"])
fi
]
)
AC_ARG_WITH(
[magma],
[AS_HELP_STRING([--with-magma], [use MAGMA @<:@default=check@:>@])],
[],
[]
)
AC_ARG_ENABLE(
[ilp64],
[AS_HELP_STRING([--enable-ilp64], [use MAGMA @<:@default=check@:>@])],
[],
[]
)
FFLAGS="-std=legacy -O3"
CXXFLAGS="-O3 -ggdb -Wno-format-contains-nul -I$HDF5_INCLUDE $OMPFLAGS $LAPACK_FLAGS"
SUBDIRS="cluster libnptm sphere testing trapping"
# Send output to Makefiles # Send output to Makefiles
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment