[QE-users] Building QE 6.5 with MKL static link

Caleb Ho calebh at fb.com
Tue Feb 25 21:01:30 CET 2020


Sorry forgot to hit reply all the first time...


Thanks for the tip Paolo! For those who have this issue in the future, I got it working after fiddling around with the M4 files. In summary,

  *   Changed "-x f95-cpp-input" to "-cpp" (see https://gcc.gnu.org/ml/gcc-help/2013-07/msg00169.html)
  *   Remove clearing of LIBS environment variable in the relevant switch cases of the BLAS and ScaLAPACK M4 files.
  *   Remove "-l<some_mkl_lib>" from the link line

Then before running configure, I set LIBS and LD_LIBS to the link line I obtained from MKL link advisor.

Below is the diff of the M4 files:

diff --git a/install/m4/x_ac_qe_blas.m4 b/install/m4/x_ac_qe_blas.m4
index 159b13990..2ebe6f496 100644
--- a/install/m4/x_ac_qe_blas.m4
+++ b/install/m4/x_ac_qe_blas.m4
@@ -213,18 +213,17 @@ then
                         fi
                         FFLAGS="$test_fflags"
                         LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"
-                        LIBS=""
+                        # LIBS=""
                         #
                         # should work for recent MKL versions only
                         #
                         if test "$use_openmp" -eq 0; then
                            if test "$f90" = "gfortran" ; then
-          AC_SEARCH_LIBS(dgemm, mkl_gf_lp64,
+          AC_SEARCH_LIBS(dgemm, "",
                                  have_blas=1 have_mkl=1
-                                 blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core"
+                                 blas_libs="$try_loption $LIBS"
                                  ldflags="$MKL_FLAGS $ldflags",
-                                 echo "MKL not found",
-                                 -lmkl_sequential -lmkl_core)
+                                 echo "MKL not found")
    else
           AC_SEARCH_LIBS(dgemm, mkl_intel_lp64,
                                  have_blas=1 have_mkl=1
diff --git a/install/m4/x_ac_qe_f90.m4 b/install/m4/x_ac_qe_f90.m4
index 2beec70d3..2e61aa46f 100644
--- a/install/m4/x_ac_qe_f90.m4
+++ b/install/m4/x_ac_qe_f90.m4
@@ -211,7 +211,7 @@ ppc64-bgq:*xlf* )
             try_fflags="-O2 -g -pedantic -Wall -Wextra -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all"
         fi
         try_fflags_openmp="-fopenmp"
-        try_f90flags="\$(FFLAGS) -x f95-cpp-input"
+        try_f90flags="\$(FFLAGS) -cpp"
         try_fflags_noopt="-O0 -g"
         try_ldflags="-g"
         try_ldflags_openmp="-pthread -fopenmp"
diff --git a/install/m4/x_ac_qe_scalapack.m4 b/install/m4/x_ac_qe_scalapack.m4
index 3c5dd5718..7a2b9f21f 100644
--- a/install/m4/x_ac_qe_scalapack.m4
+++ b/install/m4/x_ac_qe_scalapack.m4
@@ -41,11 +41,11 @@ if test "$have_mkl" -eq 1
       else
          scalapack_libs=-lmkl_blacs_intelmpi_lp64
       fi
-      AC_SEARCH_LIBS(pdgemr2d, "mkl_scalapack_lp64" , have_scalapack=1
+      AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1
                      try_dflags="$try_dflags -D__SCALAPACK"
-                     scalapack_libs="-lmkl_scalapack_lp64 $scalapack_libs",
+                     scalapack_libs="",
                      ,
-                     "$scalapack_libs" )
+                     "" )
       test "$have_scalapack" -eq 1 && break
 fi
 #

________________________________
From: users <users-bounces at lists.quantum-espresso.org> on behalf of Paolo Giannozzi <p.giannozzi at gmail.com>
Sent: Sunday, February 23, 2020 12:25 AM
To: Quantum ESPRESSO users Forum <users at lists.quantum-espresso.org>
Subject: Re: [QE-users] Building QE 6.5 with MKL static link

You should look into install/config.log and figure out why all linking test fail. Alternatively: run "configure" for normal (dynamic) linking, manually edit make.inc

Paolo

On Sat, Feb 22, 2020 at 12:22 PM Caleb Ho <calebh at fb.com<mailto:calebh at fb.com>> wrote:
Hi all,

I'm trying to build 6.5 (specifically, I'm at the "qe-6.5" tag) with Intel MKL statically linked. I've attached the output and settings I put into MKL Link Line Advisor. Here's the beginning output of configure which fails to find dgemm:

$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking ARCH... x86_64
checking setting AR... ... ar
checking setting ARFLAGS... ... ruv
checking for gfortran... gfortran
checking whether the Fortran compiler works... yes
checking for Fortran compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU Fortran compiler... yes
checking whether gfortran accepts -g... yes
checking for mpif90... mpif90
checking whether we are using the GNU Fortran compiler... yes
checking whether mpif90 accepts -g... yes
checking version of mpif90... gfortran 5.3
checking for Fortran flag to compile .f90 files... none
setting F90... gfortran
setting MPIF90... mpif90
checking whether we are using the GNU C compiler... yes
checking whether /public/apps/gcc/5.3.0/bin/gcc accepts -g... yes
checking for /public/apps/gcc/5.3.0/bin/gcc option to accept ISO C89... none needed
setting CC... /public/apps/gcc/5.3.0/bin/gcc
setting CFLAGS... -O3
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
setting F77... gfortran
using F90... gfortran
setting FFLAGS... -O3 -g
setting F90FLAGS... $(FFLAGS) -x f95-cpp-input
setting FFLAGS_NOOPT... -O0 -g
setting CPP... cpp
setting CPPFLAGS... -P -traditional -Uvector
setting LD... mpif90
setting LDFLAGS... /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64/libmkl_gf_lp64.a /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64/libmkl_sequential.a /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64/libmkl_core.a /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64/libmkl_blacs_openmpi_lp64.a -Wl,--end-group -lpthread -lm -ldl
checking whether make sets $(MAKE)... yes
checking whether Fortran files must be preprocessed... no
checking for library containing dgemm... no
MKL not found
in /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64: checking for library containing dgemm... no
MKL not found
in /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/tbb/lib/intel64_lin/gcc4.7: checking for library containing dgemm... no
MKL not found
in /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/compiler/lib/intel64_lin: checking for library containing dgemm... no
MKL not found

Best,
Caleb Ho
Facebook, Inc.

_______________________________________________
Quantum ESPRESSO is supported by MaX (www.max-centre.eu/quantum-espresso<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.max-2Dcentre.eu_quantum-2Despresso&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=ZZXVtkd1bN1008PhXfC1Mg&m=KHGcGPNq5xBdM0LyL-baS4_ZjaSq4QTMGmi3u0PLTo4&s=kofDzIkZwrPj4UtqFjwbSl6RbiwC6CdqIq_4tPg1N2k&e=>)
users mailing list users at lists.quantum-espresso.org<mailto:users at lists.quantum-espresso.org>
https://lists.quantum-espresso.org/mailman/listinfo/users<https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.quantum-2Despresso.org_mailman_listinfo_users&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=ZZXVtkd1bN1008PhXfC1Mg&m=KHGcGPNq5xBdM0LyL-baS4_ZjaSq4QTMGmi3u0PLTo4&s=6Z9fDx85lSXFfHuLjcFKs2towgPUtEbvMOjaSz_b7vQ&e=>


--
Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,
Univ. Udine, via delle Scienze 208, 33100 Udine, Italy
Phone +39-0432-558216, fax +39-0432-558222

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20200225/8ec17fd9/attachment.html>


More information about the users mailing list