From ac4d0c3af7dedee2bdb73f45aa02f9685a4e2a64 Mon Sep 17 00:00:00 2001 From: TZ Date: Sun, 1 Mar 2020 17:08:33 +0100 Subject: Quantum-Espresso: qe-6.5 fails to detect MKL for FFT (#15276) * Quantum-Espresso: qe-6.5 fails to detect MKL for FFT qe-6.5 fails to detect MKL for FFT if BLAS_LIBS is set due to an unfortunate upsteam change in their autoconf/configure: - qe-6.5/install/m4/x_ac_qe_blas.m4 only sets 'have_blas' but no 'have_mkl' if BLAS_LIBS is set (which seems to be o.k.) - however, qe-6.5/install/m4/x_ac_qe_fft.m4 in 6.5 unfortunately relies on x_ac_qe_blas.m4 to detect MKL and set 'have_mkl' - qe-5.4 up to 6.4.1 had a different logic and worked fine with BLAS_LIBS being set However, MKL is correctly picked up by qe-6.5 for BLAS and FFT if MKLROOT is set (which SPACK does automatically for ^intel-mkl). Thus, do not set BLAS_LIBS when compiling qe-6.5 with intel-mkl. * replace all '^intel-mkl' by '^mkl' to match other packages which also provide MKL e.g. intel-parallel-studio+mkl as mentioned by @adamjstewart in #15276 --- .../builtin/packages/quantum-espresso/package.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py index 49352192f7..403a8a3082 100644 --- a/var/spack/repos/builtin/packages/quantum-espresso/package.py +++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py @@ -78,7 +78,7 @@ class QuantumEspresso(Package): # Conflicts # MKL with 64-bit integers not supported. conflicts( - '^intel-mkl+ilp64', + '^mkl+ilp64', msg='Quantum ESPRESSO does not support MKL 64-bit integer variant' ) @@ -211,7 +211,7 @@ class QuantumEspresso(Package): # you need to pass it in the FFTW_INCLUDE and FFT_LIBS directory. # QE supports an internal FFTW2, but only an external FFTW3 interface. - if '^intel-mkl' in spec: + if '^mkl' in spec: # A seperate FFT library is not needed when linking against MKL options.append( 'FFTW_INCLUDE={0}'.format(join_path(env['MKLROOT'], @@ -230,10 +230,21 @@ class QuantumEspresso(Package): # appear twice in in link line but this is harmless lapack_blas = spec['lapack'].libs + spec['blas'].libs - options.append('BLAS_LIBS={0}'.format(lapack_blas.ld_flags)) + # qe-6.5 fails to detect MKL for FFT if BLAS_LIBS is set due to + # an unfortunate upsteam change in their autoconf/configure: + # - qe-6.5/install/m4/x_ac_qe_blas.m4 only sets 'have_blas' + # but no 'have_mkl' if BLAS_LIBS is set (which seems to be o.k.) + # - however, qe-6.5/install/m4/x_ac_qe_fft.m4 in 6.5 unfortunately + # relies on x_ac_qe_blas.m4 to detect MKL and set 'have_mkl' + # - qe-5.4 up to 6.4.1 had a different logic and worked fine with + # BLAS_LIBS being set + # However, MKL is correctly picked up by qe-6.5 for BLAS and FFT if + # MKLROOT is set (which SPACK does automatically for ^mkl) + if not ('quantum-espresso@6.5' in spec and '^mkl' in spec): + options.append('BLAS_LIBS={0}'.format(lapack_blas.ld_flags)) if '+scalapack' in spec: - scalapack_option = 'intel' if '^intel-mkl' in spec else 'yes' + scalapack_option = 'intel' if '^mkl' in spec else 'yes' options.append('--with-scalapack={0}'.format(scalapack_option)) if '+elpa' in spec: -- cgit v1.2.3-70-g09d2