Commit 97aa990d authored by Yann Pouillon's avatar Yann Pouillon
Browse files

Improve linear algebra detection in libOMM

parent eec66cad
......@@ -44,6 +44,7 @@ AC_DEFUN([OMM_LINALG_DETECT],[
AC_LANG_POP([Fortran])
dnl Check ScaLAPACK routines
if test "${omm_mpi_ok}" = "yes"; then
AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([whether linear algebra libraries have ScaLAPACK])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],
......@@ -52,6 +53,9 @@ AC_DEFUN([OMM_LINALG_DETECT],[
]])], [omm_linalg_has_scalapack="yes"], [omm_linalg_has_scalapack="no"])
AC_MSG_RESULT([${omm_linalg_ok}])
AC_LANG_POP([Fortran])
else
omm_linalg_has_scalapack="no"
fi
dnl Restore environment
CPPFLAGS="${saved_CPPFLAGS}"
......
......@@ -339,9 +339,11 @@ if test -n "${tmp_mpi_vars}" -a -n "${with_mpi}"; then
not both.])
fi
if test -n "${LINALG_LIBS}" -a -n "${with_linalg}"; then
AC_MSG_ERROR([conflicting option settings
if test "${with_linalg}" != "no" -a "${with_linalg}" != "yes"; then
AC_MSG_ERROR([conflicting option settings
Please use LINALG_LIBS or --with-linalg,
not both.])
fi
fi
if test -n "${tmp_psp_vars}" -a -n "${with_psp}"; then
AC_MSG_ERROR([conflicting option settings
......@@ -568,6 +570,7 @@ fi
# Look for linear algebra
AC_MSG_CHECKING([whether to look for linear algebra])
AC_MSG_RESULT([${omm_linalg_enable}])
omm_saved_LIBSA="${LIBS}"
if test "${omm_linalg_enable}" = "yes"; then
AC_MSG_CHECKING([how linear algebra parameters have been set])
AC_MSG_RESULT([${omm_linalg_type}])
......@@ -576,10 +579,22 @@ if test "${omm_linalg_enable}" = "yes"; then
AC_MSG_CHECKING([for linear algebra library flags])
AC_MSG_RESULT([${omm_linalg_libs}])
OMM_LINALG_DETECT
if test "${omm_linalg_ok}" != "yes" -a "${omm_linalg_type}" = "def"; then
AC_MSG_NOTICE([retrying with generic linear algebra library flags (Netlib)])
LIBS="-lscalapack -lblacs -lblacsCinit -lblacsF77init -llapack -lblas ${LIBS}"
OMM_LINALG_DETECT
if test "${omm_linalg_ok}" != "yes"; then
if test "${omm_linalg_type}" = "def" -o "${omm_linalg_type}" = "yon"; then
AC_MSG_NOTICE([retrying with generic linear algebra library flags (Netlib)])
LIBS="-llapack -lblas ${omm_saved_LIBS}"
if test "${msw_mpi_ok}" = "yes"; then
LIBS="-lscalapack ${LIBS}"
fi
OMM_LINALG_DETECT
fi
fi
if test "${omm_linalg_ok}" != "yes" -a "${omm_mpi_ok}" = "yes"; then
if test "${omm_linalg_type}" = "def" -o "${omm_linalg_type}" = "yon"; then
AC_MSG_NOTICE([retrying with deprecated linear algebra library flags (Netlib)])
LIBS="-lscalapack -lblacs -lblacsCinit -lblacsF77init -llapack -lblas ${omm_saved_LIBS}"
OMM_LINALG_DETECT
fi
fi
if test "${omm_linalg_ok}" = "yes"; then
CPPFLAGS="${CPPFLAGS} ${omm_linalg_incs}"
......
......@@ -115,6 +115,17 @@ make -j${make_nprocs} check || /bin/true
sleep 3
cd ..
# Set distribution-specific parameters
distro=$(lsb_release -is 2>/dev/null)
case "${distro}" in
Ubuntu)
export LINALG_LIBS="-lscalapack-openmpi -llapack -lblas"
;;
*)
export LINALG_LIBS="-lscalapack -lopenblas"
;;
esac
# Check MPI + Linalg build
mkdir tmp-mpi-linalg
cd tmp-mpi-linalg
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment