configure.ac - search for openblas too

This commit is contained in:
jiri committed 2026-11-05 20:32:26 +01:00
1 parent 61960f83ce
commit 723823dd50
2 files changed
+43 -9

No files matched your search

+36 -7
View File
@@ -40,14 +40,41 @@ then
MKLOPT="-DHAS_MKL" MKLOPT="-DHAS_MKL"
AC_SUBST([MKLOPT]) AC_SUBST([MKLOPT])
else else
echo "MKL LIBRARY OR HEADER NOT FOUND, will try ATLAS next!" echo "MKL LIBRARY OR HEADER NOT FOUND, will try OpenBLAS next!"
fi
FORINTOPT=""
forint64=""
AC_ARG_ENABLE([fortran64int],[ --enable-fortran64int to link with 64-bit-integer-BLAS+LAPACK ],[forint64=${enableval}],)
AC_ARG_ENABLE([fotran64int],[ --enable-fotran64int old misspelled alias of --enable-fortran64int ],[forint64=${enableval}],)
# OpenBLAS (with LAPACK and CBLAS included) is preferred if MKL is not present; not for 64-bit integers
openblas_present=0
AC_ARG_WITH([openblas],[ --without-openblas do not use OpenBLAS even if found (use ATLAS or reference BLAS)],[],[with_openblas=yes])
case "${forint64}" in
""|no) ;;
*) with_openblas=no ;;
esac
if test $mkl_present == 0 -a "${with_openblas}" != no
then
AC_CHECK_LIB([openblas], [dgeev_], [AC_CHECK_LIB([openblas], [cblas_dgemm], [openblas_present=1])])
fi
if test $openblas_present == 1
then
echo "OPENBLAS FOUND"
BLASLIB="-lopenblas"
AC_SUBST([BLASLIB])
CLAPACKOPT=-DNONCLAPACK
AC_SUBST([CLAPACKOPT])
else
echo "OPENBLAS NOT FOUND OR NOT USED, will try ATLAS next!"
fi fi
# Checks for mandatory libraries. # Checks for mandatory libraries.
ATLASLIB="" ATLASLIB=""
if test $mkl_present == 0 if test $mkl_present == 0 -a $openblas_present == 0
then then
AC_CHECK_LIB([atlas], [ATL_zgemv],ATLASLIB="-lblas -latlas", [ AC_CHECK_LIB([atlas], [ATL_zgemv],ATLASLIB="-lblas -latlas", [
echo "ATLAS not found, I hope you are using some other efficient BLAS!" echo "ATLAS not found, I hope you are using some other efficient BLAS!"
@@ -75,7 +102,13 @@ AC_ARG_ENABLE([matptr],[ --enable-matptr switch to double** matrix representa
CBLASLIB="" CBLASLIB=""
CBLASOPT="" CBLASOPT=""
if test $mkl_present == 0 if test $openblas_present == 1
then
AC_CHECK_HEADER([cblas.h],,[CBLASOPT=-DNONCBLAS], AC_INCLUDES_DEFAULT)
AC_SUBST([CBLASOPT])
fi
if test $mkl_present == 0 -a $openblas_present == 0
then then
AC_CHECK_LIB([cblas], [cblas_ddot], [CBLASLIB="-lcblas"], [CBLASOPT=-DNONCBLAS],[$ATLASLIB]) AC_CHECK_LIB([cblas], [cblas_ddot], [CBLASLIB="-lcblas"], [CBLASOPT=-DNONCBLAS],[$ATLASLIB])
AC_CHECK_HEADER([cblas.h],,[CBLASOPT=-DNONCBLAS CBLASLIB=""], AC_INCLUDES_DEFAULT) AC_CHECK_HEADER([cblas.h],,[CBLASOPT=-DNONCBLAS CBLASLIB=""], AC_INCLUDES_DEFAULT)
@@ -107,10 +140,6 @@ AC_SUBST([MATPTROPT])
#process options #process options
FORINTOPT=""
forint64=""
AC_ARG_ENABLE([fortran64int],[ --enable-fortran64int to link with 64-bit-integer-BLAS+LAPACK ],[forint64=${enableval}],)
AC_ARG_ENABLE([fotran64int],[ --enable-fotran64int old misspelled alias of --enable-fortran64int ],[forint64=${enableval}],)
if test -n "${forint64}"; then if test -n "${forint64}"; then
case "${forint64}" in case "${forint64}" in
yes) FORINTOPT="-DLONG_FORTRAN_INT" yes) FORINTOPT="-DLONG_FORTRAN_INT"
+7 -2
View File
@@ -5,7 +5,7 @@
\begin{itemize} \begin{itemize}
\item a C++11 capable compiler (the library is developed with GNU g++), \item a C++11 capable compiler (the library is developed with GNU g++),
\item BLAS and LAPACK (Fortran interface); optionally the C interfaces CBLAS and CLAPACK, \item BLAS and LAPACK (Fortran interface); optionally the C interfaces CBLAS and CLAPACK,
or Intel MKL, or ATLAS, or Intel MKL, or OpenBLAS, or ATLAS,
\item GNU autotools (autoconf, automake, libtool) when building from the git repository, \item GNU autotools (autoconf, automake, libtool) when building from the git repository,
\item optionally NVIDIA CUBLAS (experimental, section~\ref{sec:concepts:gpu}), \item optionally NVIDIA CUBLAS (experimental, section~\ref{sec:concepts:gpu}),
\item optionally doxygen for the generated source code reference, which is independent of this manual. \item optionally doxygen for the generated source code reference, which is independent of this manual.
@@ -29,6 +29,10 @@ accordingly:
\begin{enumerate} \begin{enumerate}
\item Intel MKL (\code{mkl_intel_lp64}, \code{mkl_sequential}, \code{mkl_core} and the header \item Intel MKL (\code{mkl_intel_lp64}, \code{mkl_sequential}, \code{mkl_core} and the header
\header{mkl_cblas.h}); if found, \code{-DHAS_MKL -DNONCLAPACK} is used; \header{mkl_cblas.h}); if found, \code{-DHAS_MKL -DNONCLAPACK} is used;
\item otherwise OpenBLAS, if \code{libopenblas} contains LAPACK (\code{dgeev_}) and CBLAS (\code{cblas_dgemm}): only
\code{-lopenblas} is linked, \code{-DNONCLAPACK} is used and \code{-DNONCBLAS} if \header{cblas.h} is missing; skipped
with \code{--without-openblas} and with \code{--enable-fortran64int}. A threaded OpenBLAS uses all cores unless
\code{OPENBLAS_NUM_THREADS} is set;
\item otherwise ATLAS (optional) and the reference BLAS (mandatory), CBLAS (if \code{cblas_ddot} and \header{cblas.h} \item otherwise ATLAS (optional) and the reference BLAS (mandatory), CBLAS (if \code{cblas_ddot} and \header{cblas.h}
are not found, \code{-DNONCBLAS} is set) and LAPACK (mandatory; if the C interface \code{clapack_dgesv} are not found, \code{-DNONCBLAS} is set) and LAPACK (mandatory; if the C interface \code{clapack_dgesv}
with \header{clapack.h} is not found, \code{-DNONCLAPACK} is set); with \header{clapack.h} is not found, \code{-DNONCLAPACK} is set);
@@ -47,7 +51,8 @@ accordingly:
\code{--enable-optimize=<flags>} & compiler optimization flags, default \code{-O3 -finline-limit=1000}; \code{--disable-optimize} for none \\ \code{--enable-optimize=<flags>} & compiler optimization flags, default \code{-O3 -finline-limit=1000}; \code{--disable-optimize} for none \\
\code{--enable-profile} & compile with \code{-pg} \\ \code{--enable-profile} & compile with \code{-pg} \\
\code{--enable-matptr} & define \code{MATPTR}: \code{NRMat} stores an array of row pointers (\code{T**}), see chapter~\ref{ch:mat}; incompatible with CUDA \\ \code{--enable-matptr} & define \code{MATPTR}: \code{NRMat} stores an array of row pointers (\code{T**}), see chapter~\ref{ch:mat}; incompatible with CUDA \\
\code{--enable-fortran64int} & define \code{LONG_FORTRAN_INT} to link with BLAS and LAPACK using 64-bit integers; implies \code{NONCBLAS} and \code{NONCLAPACK} (the old misspelling \code{--enable-fotran64int} is accepted as an alias) \\ \code{--enable-fortran64int} & define \code{LONG_FORTRAN_INT} to link with BLAS and LAPACK using 64-bit integers; implies \code{NONCBLAS} and \code{NONCLAPACK} (the old misspelling \code{--enable-fotran64int} is accepted as an alias); OpenBLAS is then not used \\
\code{--without-openblas} & do not use OpenBLAS even if found (ATLAS or the reference BLAS is used) \\
\bottomrule \bottomrule
\end{longtable} \end{longtable}