<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
Sorry forgot to hit reply all the first time...</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
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,</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
<ul>
<li>Changed "-x f95-cpp-input" to "-cpp" (see <a href="https://gcc.gnu.org/ml/gcc-help/2013-07/msg00169.html" target="_blank" rel="noopener noreferrer" style="margin: 0px">https://gcc.gnu.org/ml/gcc-help/2013-07/msg00169.html</a>)</li><li>Remove clearing of LIBS environment variable in the relevant switch cases of the BLAS and ScaLAPACK M4 files.</li><li>Remove "-l<some_mkl_lib>" from the link line</li></ul>
<div style="margin: 0px">Then before running configure, I set LIBS and LD_LIBS to the link line I obtained from MKL link advisor.</div>
<div style="margin: 0px"><br>
</div>
<div style="margin: 0px">Below is the diff of the M4 files:</div>
<div style="margin: 0px"><br>
</div>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: black; background-color: white">
<span style="margin: 0px"></span><span style="margin: 0px">diff --git a/install/m4/x_ac_qe_blas.m4 b/install/m4/x_ac_qe_blas.m4<br>
</span>
<div style="margin: 0px">index 159b13990..2ebe6f496 100644<br>
</div>
<div style="margin: 0px">--- a/install/m4/x_ac_qe_blas.m4<br>
</div>
<div style="margin: 0px">+++ b/install/m4/x_ac_qe_blas.m4<br>
</div>
<div style="margin: 0px">@@ -213,18 +213,17 @@ then<br>
</div>
<div style="margin: 0px">                         fi<br>
</div>
<div style="margin: 0px">                         FFLAGS="$test_fflags"<br>
</div>
<div style="margin: 0px">                         LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"<br>
</div>
<div style="margin: 0px">-                        LIBS=""<br>
</div>
<div style="margin: 0px">+                        # LIBS=""<br>
</div>
<div style="margin: 0px">                         #<br>
</div>
<div style="margin: 0px">                         # should work for recent MKL versions only<br>
</div>
<div style="margin: 0px">                         #<br>
</div>
<div style="margin: 0px">                         if test "$use_openmp" -eq 0; then<br>
</div>
<div style="margin: 0px">                            if test "$f90" = "gfortran" ; then<br>
</div>
<div style="margin: 0px">-          AC_SEARCH_LIBS(dgemm, mkl_gf_lp64,<br>
</div>
<div style="margin: 0px">+          AC_SEARCH_LIBS(dgemm, "",<br>
</div>
<div style="margin: 0px">                                  have_blas=1 have_mkl=1<br>
</div>
<div style="margin: 0px">-                                 blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core"<br>
</div>
<div style="margin: 0px">+                                 blas_libs="$try_loption $LIBS"<br>
</div>
<div style="margin: 0px">                                  ldflags="$MKL_FLAGS $ldflags",<br>
</div>
<div style="margin: 0px">-                                 echo "MKL not found",<br>
</div>
<div style="margin: 0px">-                                 -lmkl_sequential -lmkl_core)<br>
</div>
<div style="margin: 0px">+                                 echo "MKL not found")<br>
</div>
<div style="margin: 0px">    else<br>
</div>
<div style="margin: 0px">           AC_SEARCH_LIBS(dgemm, mkl_intel_lp64,<br>
</div>
<div style="margin: 0px">                                  have_blas=1 have_mkl=1<br>
</div>
<div style="margin: 0px">diff --git a/install/m4/x_ac_qe_f90.m4 b/install/m4/x_ac_qe_f90.m4<br>
</div>
<div style="margin: 0px">index 2beec70d3..2e61aa46f 100644<br>
</div>
<div style="margin: 0px">--- a/install/m4/x_ac_qe_f90.m4<br>
</div>
<div style="margin: 0px">+++ b/install/m4/x_ac_qe_f90.m4<br>
</div>
<div style="margin: 0px">@@ -211,7 +211,7 @@ ppc64-bgq:*xlf* )<br>
</div>
<div style="margin: 0px">             try_fflags="-O2 -g -pedantic -Wall -Wextra -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all"<br>
</div>
<div style="margin: 0px">         fi<br>
</div>
<div style="margin: 0px">         try_fflags_openmp="-fopenmp"<br>
</div>
<div style="margin: 0px">-        try_f90flags="\$(FFLAGS) -x f95-cpp-input"<br>
</div>
<div style="margin: 0px">+        try_f90flags="\$(FFLAGS) -cpp"<br>
</div>
<div style="margin: 0px">         try_fflags_noopt="-O0 -g"<br>
</div>
<div style="margin: 0px">         try_ldflags="-g"<br>
</div>
<div style="margin: 0px">         try_ldflags_openmp="-pthread -fopenmp"<br>
</div>
<div style="margin: 0px">diff --git a/install/m4/x_ac_qe_scalapack.m4 b/install/m4/x_ac_qe_scalapack.m4<br>
</div>
<div style="margin: 0px">index 3c5dd5718..7a2b9f21f 100644<br>
</div>
<div style="margin: 0px">--- a/install/m4/x_ac_qe_scalapack.m4<br>
</div>
<div style="margin: 0px">+++ b/install/m4/x_ac_qe_scalapack.m4<br>
</div>
<div style="margin: 0px">@@ -41,11 +41,11 @@ if test "$have_mkl" -eq 1<br>
</div>
<div style="margin: 0px">       else<br>
</div>
<div style="margin: 0px">          scalapack_libs=-lmkl_blacs_intelmpi_lp64<br>
</div>
<div style="margin: 0px">       fi<br>
</div>
<div style="margin: 0px">-      AC_SEARCH_LIBS(pdgemr2d, "mkl_scalapack_lp64" , have_scalapack=1<br>
</div>
<div style="margin: 0px">+      AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1<br>
</div>
<div style="margin: 0px">                      try_dflags="$try_dflags -D__SCALAPACK"<br>
</div>
<div style="margin: 0px">-                     scalapack_libs="-lmkl_scalapack_lp64 $scalapack_libs",<br>
</div>
<div style="margin: 0px">+                     scalapack_libs="",<br>
</div>
<div style="margin: 0px">                      ,<br>
</div>
<div style="margin: 0px">-                     "$scalapack_libs" )<br>
</div>
<div style="margin: 0px">+                     "" )<br>
</div>
<div style="margin: 0px">       test "$have_scalapack" -eq 1 && break<br>
</div>
<div style="margin: 0px"> fi<br>
</div>
<span style="margin: 0px"> #</span></div>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> users <users-bounces@lists.quantum-espresso.org> on behalf of Paolo Giannozzi <p.giannozzi@gmail.com><br>
<b>Sent:</b> Sunday, February 23, 2020 12:25 AM<br>
<b>To:</b> Quantum ESPRESSO users Forum <users@lists.quantum-espresso.org><br>
<b>Subject:</b> Re: [QE-users] Building QE 6.5 with MKL static link</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>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</div>
<div><br>
</div>
<div>Paolo<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Sat, Feb 22, 2020 at 12:22 PM Caleb Ho <<a href="mailto:calebh@fb.com">calebh@fb.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi all,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>$ ./configure<br>
</span>
<div>checking build system type... x86_64-pc-linux-gnu<br>
</div>
<div>checking ARCH... x86_64<br>
</div>
<div>checking setting AR... ... ar<br>
</div>
<div>checking setting ARFLAGS... ... ruv<br>
</div>
<div>checking for gfortran... gfortran<br>
</div>
<div>checking whether the Fortran compiler works... yes<br>
</div>
<div>checking for Fortran compiler default output file name... a.out<br>
</div>
<div>checking for suffix of executables...<br>
</div>
<div>checking whether we are cross compiling... no<br>
</div>
<div>checking for suffix of object files... o<br>
</div>
<div>checking whether we are using the GNU Fortran compiler... yes<br>
</div>
<div>checking whether gfortran accepts -g... yes<br>
</div>
<div>checking for mpif90... mpif90<br>
</div>
<div>checking whether we are using the GNU Fortran compiler... yes<br>
</div>
<div>checking whether mpif90 accepts -g... yes<br>
</div>
<div>checking version of mpif90... gfortran 5.3<br>
</div>
<div>checking for Fortran flag to compile .f90 files... none<br>
</div>
<div>setting F90... gfortran<br>
</div>
<div>setting MPIF90... mpif90<br>
</div>
<div>checking whether we are using the GNU C compiler... yes<br>
</div>
<div>checking whether /public/apps/gcc/5.3.0/bin/gcc accepts -g... yes<br>
</div>
<div>checking for /public/apps/gcc/5.3.0/bin/gcc option to accept ISO C89... none needed<br>
</div>
<div>setting CC... /public/apps/gcc/5.3.0/bin/gcc<br>
</div>
<div>setting CFLAGS... -O3<br>
</div>
<div>checking for gfortran... gfortran<br>
</div>
<div>checking whether we are using the GNU Fortran 77 compiler... yes<br>
</div>
<div>checking whether gfortran accepts -g... yes<br>
</div>
<div>setting F77... gfortran<br>
</div>
<div>using F90... gfortran<br>
</div>
<div>setting FFLAGS... -O3 -g<br>
</div>
<div>setting F90FLAGS... $(FFLAGS) -x f95-cpp-input<br>
</div>
<div>setting FFLAGS_NOOPT... -O0 -g<br>
</div>
<div>setting CPP... cpp<br>
</div>
<div>setting CPPFLAGS... -P -traditional -Uvector<br>
</div>
<div>setting LD... mpif90<br>
</div>
<div>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<br>
</div>
<div>checking whether make sets $(MAKE)... yes<br>
</div>
<div>checking whether Fortran files must be preprocessed... no<br>
</div>
<div>checking for library containing dgemm... no<br>
</div>
<div>MKL not found<br>
</div>
<div>in /public/apps/intel/mkl/2019.5.281/compilers_and_libraries_2019.5.281/linux/mkl/lib/intel64: checking for library containing dgemm... no<br>
</div>
<div>MKL not found<br>
</div>
<div>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<br>
</div>
<div>MKL not found<br>
</div>
<div>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<br>
</div>
<span>MKL not found</span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Best,</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Caleb Ho</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Facebook, Inc.</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
_______________________________________________<br>
Quantum ESPRESSO is supported by MaX (<a href="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=" rel="noreferrer" target="_blank">www.max-centre.eu/quantum-espresso</a>)<br>
users mailing list <a href="mailto:users@lists.quantum-espresso.org" target="_blank">
users@lists.quantum-espresso.org</a><br>
<a href="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=" rel="noreferrer" target="_blank">https://lists.quantum-espresso.org/mailman/listinfo/users</a></blockquote>
</div>
<br clear="all">
<br>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,<br>
Univ. Udine, via delle Scienze 208, 33100 Udine, Italy<br>
Phone +39-0432-558216, fax +39-0432-558222<br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>