From c175c05af9fb382ef740be47c725948e45095faf Mon Sep 17 00:00:00 2001 From: Toyohisa Kameyama Date: Sat, 30 Jan 2021 10:36:58 +0900 Subject: [PATCH] quantum-expresso: fix for Fujitsu compiler (#21368) --- .../packages/quantum-espresso/fj-fox.patch | 10 ++++++ .../quantum-espresso/fj-intent.6.4.1.patch | 11 +++++++ .../packages/quantum-espresso/fj.6.5.patch | 23 ++++++++++++++ .../packages/quantum-espresso/fj.6.6.patch | 23 ++++++++++++++ .../packages/quantum-espresso/package.py | 31 +++++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 var/spack/repos/builtin/packages/quantum-espresso/fj-fox.patch create mode 100644 var/spack/repos/builtin/packages/quantum-espresso/fj-intent.6.4.1.patch create mode 100644 var/spack/repos/builtin/packages/quantum-espresso/fj.6.5.patch create mode 100644 var/spack/repos/builtin/packages/quantum-espresso/fj.6.6.patch diff --git a/var/spack/repos/builtin/packages/quantum-espresso/fj-fox.patch b/var/spack/repos/builtin/packages/quantum-espresso/fj-fox.patch new file mode 100644 index 0000000000..d4fb79ab2c --- /dev/null +++ b/var/spack/repos/builtin/packages/quantum-espresso/fj-fox.patch @@ -0,0 +1,10 @@ +--- spack-src/install/extlibs_makefile.org 2021-01-22 10:11:00.527343202 +0900 ++++ spack-src/install/extlibs_makefile 2021-01-22 10:15:24.319956918 +0900 +@@ -89,6 +89,7 @@ + mkdir ../FoX; \ + (gzip -dc ../archive/fox.tgz | (cd ../FoX; tar -xvf -)); \ + cd ../FoX/fox/; export FC=$(F90); export FCFLAGS="$(FOX_FLAGS)"; \ ++ sed -i 's/"-out " "-o "/"-o " "-out "/' configure; \ + ./configure --prefix=$(TOPDIR)/FoX ;\ + $(MAKE) install; cd ../; rm -fr fox;fi + # ELPA diff --git a/var/spack/repos/builtin/packages/quantum-espresso/fj-intent.6.4.1.patch b/var/spack/repos/builtin/packages/quantum-espresso/fj-intent.6.4.1.patch new file mode 100644 index 0000000000..7266a9b568 --- /dev/null +++ b/var/spack/repos/builtin/packages/quantum-espresso/fj-intent.6.4.1.patch @@ -0,0 +1,11 @@ +--- spack-src/PHonon/Gamma/dgradcorr.f90.org 2021-01-27 16:41:04.692204340 +0900 ++++ spack-src/PHonon/Gamma/dgradcorr.f90 2021-01-27 16:44:03.877839298 +0900 +@@ -22,7 +22,7 @@ + + REAL(DP), INTENT(IN) :: rho (dfft%nnr, nspin), grho (3, dfft%nnr, nspin), & + g (3, dfft%ngm) +- REAL(DP), INTENT(OUT):: drho (dfft%nnr,nspin),& ++ REAL(DP), INTENT(IN):: drho (dfft%nnr,nspin),& + dvxc_rr(dfft%nnr, nspin, nspin), dvxc_sr (dfft%nnr, nspin, nspin), & + dvxc_ss (dfft%nnr,nspin, nspin), dvxc_s (dfft%nnr, nspin, nspin) + REAL(DP), INTENT(INOUT) :: dvxc (dfft%nnr, nspin) diff --git a/var/spack/repos/builtin/packages/quantum-espresso/fj.6.5.patch b/var/spack/repos/builtin/packages/quantum-espresso/fj.6.5.patch new file mode 100644 index 0000000000..503a0e9ecf --- /dev/null +++ b/var/spack/repos/builtin/packages/quantum-espresso/fj.6.5.patch @@ -0,0 +1,23 @@ +--- spack-src/install/configure.org 2021-01-22 12:21:20.196915072 +0900 ++++ spack-src/install/configure 2021-01-22 12:24:47.562530103 +0900 +@@ -3127,6 +3127,7 @@ + pgf_version=`$mpif90 -V 2>&1 | grep "^pgf"` + gfortran_version=`$mpif90 -v 2>&1 | grep "gcc version"` + nagfor_version=`$mpif90 -v 2>&1 | grep "NAG Fortran"` ++ frt_version=`$mpif90 -v 2>&1 | grep "Fujitsu Fortran Compiler"` + xlf_version=`$mpif90 -v 2>&1 | grep "xlf"` + # + if test "$ifort_version" != "" +@@ -3160,6 +3161,12 @@ + echo "${ECHO_T}xlf (version unknonw)" + f90_in_mpif90="xlf" + try_dflags="-D__XLF" ++ elif test "$frt_version" != "" ++ then ++ version=`echo $frt_version | cut -d" " -f 5` ++ echo "${ECHO_T}frt $version" ++ f90_in_mpif90="frt" ++ try_foxflags="-D__FUJITSU" + else + echo "${ECHO_T}unknown, assuming gfortran" + f90_in_mpif90="gfortran" diff --git a/var/spack/repos/builtin/packages/quantum-espresso/fj.6.6.patch b/var/spack/repos/builtin/packages/quantum-espresso/fj.6.6.patch new file mode 100644 index 0000000000..7b2db5d8d5 --- /dev/null +++ b/var/spack/repos/builtin/packages/quantum-espresso/fj.6.6.patch @@ -0,0 +1,23 @@ +--- spack-src/install/configure.org 2021-01-15 09:27:53.000000000 +0900 ++++ spack-src/install/configure 2021-01-15 09:26:53.000000000 +0900 +@@ -3200,6 +3200,7 @@ + nagfor_version=`$mpif90 -v 2>&1 | grep "NAG Fortran"` + xlf_version=`$mpif90 -v 2>&1 | grep "xlf"` + armflang_version=`$mpif90 -v 2>&1 | grep "Arm C/C++/Fortran Compiler version"` ++ frt_version=`$mpif90 -v 2>&1 | grep "Fujitsu Fortran Compiler"` + # + if test "$ifort_version" != "" + then +@@ -3237,6 +3238,12 @@ + f90_minor_version=`echo $version | cut -d. -f2` + f90_in_mpif90="armflang" + try_foxflags="-D__PGI" ++ elif test "$frt_version" != "" ++ then ++ version=`echo $frt_version | cut -d" " -f 5` ++ echo "${ECHO_T}frt $version" ++ f90_in_mpif90="frt" ++ try_foxflags="-D__FUJITSU" + else + echo "${ECHO_T}unknown, assuming gfortran" + f90_in_mpif90="gfortran" diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py index a8604764f1..de522827b4 100644 --- a/var/spack/repos/builtin/packages/quantum-espresso/package.py +++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py @@ -226,6 +226,16 @@ class QuantumEspresso(Package): patch('https://gitlab.com/QEF/q-e/-/commit/cf1fedefc20d39f5cd7551ded700ea4c77ad6e8f.diff', sha256='8f179663a8d031aff9b1820a32449942281195b6e7b1ceaab1f729651b43fa58', when='+patch@6.6') + # QE 6.5 INTENT(OUT) without settig value in tetra_weights_only(..., ef): + # For Fujitsu compiler + patch('https://gitlab.com/QEF/q-e/-/commit/8f096b53e75026701c681c508e2c24a9378c0950.diff', + sha256='f4f1cce4182b57ac797c8f6ec8460fe375ee96385fcd8f6a61e1460bc957eb67', + when='+patch@6.5') + # QE 6.5 Fix INTENT + # For Fujitsu compiler + patch('https://gitlab.com/QEF/q-e/-/commit/c2a86201ed72693ffa50cc99b22f5d3365ae2c2b.diff', + sha256='b2dadc0bc008a3ad4b74ae85cc380dd2b63f2ae43a634e6f9d8db8077efcea6c', + when='+patch@6.5') # QE 6.3 requires multiple patches to fix MKL detection # There may still be problems on Mac with MKL detection patch('https://gitlab.com/QEF/q-e/commit/0796e1b7c55c9361ecb6515a0979280e78865e36.diff', @@ -244,9 +254,28 @@ class QuantumEspresso(Package): sha256='b1aa3179ee1c069964fb9c21f3b832aebeae54947ce8d3cc1a74e7b154c3c10f', when='+patch@6.4.1:6.5.0') + # QE 6.4.1 Fix intent for Fujitsu compiler + patch('fj-intent.6.4.1.patch', when='+patch@6.4.1') + # QE 6.4.1 Fix intent + patch('https://gitlab.com/QEF/q-e/-/commit/c2a86201ed72693ffa50cc99b22f5d3365ae2c2b.diff', + sha256='b2dadc0bc008a3ad4b74ae85cc380dd2b63f2ae43a634e6f9d8db8077efcea6c', + when='+patch@6.4.1') + + # QE 6.4.1 Small fixes for XLF compilation + patch('https://gitlab.com/QEF/q-e/-/commit/cf088926d68792cbaea48960c222e336a3965df6.diff', + sha256='bbceba1fb08d01d548d4393bbcaeae966def13f75884268a0f84448457b8eaa3', + when='+patch@6.4.1:6.5.0') + # Configure updated to work with NVIDIA compilers patch('nvhpc.patch', when='@6.5 %nvhpc') + # Configure updated to work with Fujitsu compilers + patch('fj.6.5.patch', when='@6.5+patch %fj') + patch('fj.6.6.patch', when='@6.6:6.7+patch %fj') + + # extlibs_makefile updated to work with fujitsu compilers + patch('fj-fox.patch', when='+patch %fj') + # Spurious problems running in parallel the Makefile # generated by the configure parallel = False @@ -347,6 +376,8 @@ def install(self, spec, prefix): else: scalapack_option = 'yes' options.append('--with-scalapack={0}'.format(scalapack_option)) + scalapack_lib = spec['scalapack'].libs + options.append('SCALAPACK_LIBS={0}'.format(scalapack_lib)) if '+elpa' in spec: