From c4a6e90cdca7bc46c404d2daaf5d93540db43c4f Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 5 Dec 2018 18:33:07 +0100 Subject: [PATCH] Add DEAL_II_LAPACK_WITH_MKL macro which will be set if Intel MKL is being used --- cmake/configure/configure_1_lapack.cmake | 31 +++++++++++++++++++ doc/news/changes/minor/20181205DenisDavydov-1 | 3 ++ include/deal.II/base/config.h.in | 1 + 3 files changed, 35 insertions(+) create mode 100644 doc/news/changes/minor/20181205DenisDavydov-1 diff --git a/cmake/configure/configure_1_lapack.cmake b/cmake/configure/configure_1_lapack.cmake index d9f682eebd..2eb4519a15 100644 --- a/cmake/configure/configure_1_lapack.cmake +++ b/cmake/configure/configure_1_lapack.cmake @@ -77,6 +77,37 @@ MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() + + # + # See if we use Intel-MKL by compiling a small program + # + SET(CMAKE_REQUIRED_INCLUDES + ${LAPACK_INCLUDE_DIRS} + ) + CHECK_CXX_SOURCE_COMPILES(" + #include + #include + int main(){ + const int m = 5; + const int n = 2; + std::vector A(m*n,0.); + std::vector B(m*n,0.); + mkl_domatcopy('C', 'T', m, n, 1., A.data(), n, B.data(), m); + return 0; + }" + MKL_SYMBOL_CHECK) + IF(MKL_SYMBOL_CHECK) + MESSAGE(STATUS + "Use Intel MKL for BLAS/LAPACK." + ) + SET(DEAL_II_LAPACK_WITH_MKL ON) + ELSE() + MESSAGE(STATUS + "Use other than Intel MKL implementation of BLAS/LAPACK (consult CMakeFiles/CMakeError.log for further information)." + ) + SET(DEAL_II_LAPACK_WITH_MKL OFF) + ENDIF() + ENDIF() ENDMACRO() diff --git a/doc/news/changes/minor/20181205DenisDavydov-1 b/doc/news/changes/minor/20181205DenisDavydov-1 new file mode 100644 index 0000000000..cd4052cceb --- /dev/null +++ b/doc/news/changes/minor/20181205DenisDavydov-1 @@ -0,0 +1,3 @@ +New: Add DEAL_II_LAPACK_WITH_MKL macro which will be set if Intel MKL is being used. +
+(Denis Davydov, 2018/12/05) diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index e9cace6977..325f61fedb 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -47,6 +47,7 @@ #cmakedefine DEAL_II_WITH_HDF5 #cmakedefine DEAL_II_WITH_LAPACK #cmakedefine LAPACK_WITH_64BIT_BLAS_INDICES +#cmakedefine DEAL_II_LAPACK_WITH_MKL #cmakedefine DEAL_II_WITH_METIS #cmakedefine DEAL_II_WITH_MPI #cmakedefine DEAL_II_WITH_MUPARSER -- 2.39.5