diff options
-rw-r--r-- | var/spack/repos/builtin/packages/quantum-espresso/configure_aocc.patch | 58 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/quantum-espresso/package.py | 29 |
2 files changed, 86 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/quantum-espresso/configure_aocc.patch b/var/spack/repos/builtin/packages/quantum-espresso/configure_aocc.patch new file mode 100644 index 0000000000..69d5293ab8 --- /dev/null +++ b/var/spack/repos/builtin/packages/quantum-espresso/configure_aocc.patch @@ -0,0 +1,58 @@ +--- spack-src/install/configure.orig 2021-02-11 13:56:58.900212951 +0530 ++++ spack-src/install/configure 2021-02-11 15:19:54.726403962 +0530 +@@ -3203,6 +3203,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"` ++ aoccflang_version=`$mpif90 -v 2>&1 | grep "AMD clang version"` + # + if test "$ifort_version" != "" + then +@@ -3227,6 +3228,12 @@ + f90_minor_version=`echo $version | cut -d. -f2` + echo "${ECHO_T}gfortran $f90_major_version.$f90_minor_version" + f90_in_mpif90="gfortran" ++ elif test "$aoccflang_version" != "" ++ then ++ version=`echo $aoccflang_version | cut -d" " -f 5` ++ echo "${ECHO_T}mpif90 $version" ++ f90_in_mpif90="mpif90" ++ try_foxflags="-D__PGI" + elif test "$nagfor_version" != "" + then + # NAG 6.0 has the codename attached to version number... annoying +@@ -3327,6 +3334,8 @@ + f90_flavor=ifort + elif $f90 -V 2>&1 | grep -q "^pgf" ; then + f90_flavor=pgf ++ elif $f90 -v 2>&1 | grep -q "AMD clang version" ; then ++ f90_flavor=mpif90 + elif $f90 -v 2>&1 | grep -q "gcc version" ; then + f90_flavor=gfortran + elif $f90 -V 2>&1 | grep -q "Cray Fortran" ; then +@@ -3385,6 +3394,9 @@ + *:pgf90 ) + try_cc="pgcc $try_cc" + ;; ++*:mpif90 ) ++ try_cc="mpicc $try_cc" ++ ;; + cray*:* ) + try_cc="cc" + ;; +@@ -4017,6 +4029,15 @@ + try_dflags="$try_dflags -D__PGI" + have_cpp=1 + ;; ++*:*mpif90 ) ++ try_fflags="-O3 -g" ++ try_fflags_openmp="-fopenmp" ++ try_f90flags="\$(FFLAGS) -cpp" ++ try_fflags_noopt="-O0 -g" ++ try_ldflags="-g" ++ try_ldflags_openmp="-pthread -fopenmp" ++ try_ldflags_static="-static" ++ ;; + *:*gfortran ) + try_fflags="-O3 -g" + if test "$f90_major_version" -ge "10"; then diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py index 5188568b19..929ccbbea9 100644 --- a/var/spack/repos/builtin/packages/quantum-espresso/package.py +++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py @@ -266,6 +266,9 @@ class QuantumEspresso(Package): sha256='bbceba1fb08d01d548d4393bbcaeae966def13f75884268a0f84448457b8eaa3', when='+patch@6.4.1:6.5.0') + # Configure updated to work with AOCC compilers + patch('configure_aocc.patch', when='@6.7 %aocc') + # Configure updated to work with NVIDIA compilers patch('nvhpc.patch', when='@6.5 %nvhpc') @@ -346,6 +349,15 @@ class QuantumEspresso(Package): fftw_ld_flags = spec['fftw'].libs.ld_flags options.append('FFT_LIBS={0}'.format(fftw_ld_flags)) + if '^amdfftw' in spec: + fftw_prefix = spec['amdfftw'].prefix + options.append('FFTW_INCLUDE={0}'.format(fftw_prefix.include)) + if '+openmp' in spec: + fftw_ld_flags = spec['amdfftw:openmp'].libs.ld_flags + else: + fftw_ld_flags = spec['amdfftw'].libs.ld_flags + options.append('FFT_LIBS={0}'.format(fftw_ld_flags)) + # External BLAS and LAPACK requires the correct link line into # BLAS_LIBS, do no use LAPACK_LIBS as the autoconf scripts indicate # that this variable is largely ignored/obsolete. @@ -394,9 +406,24 @@ class QuantumEspresso(Package): options.extend([ '--with-elpa-include={0}'.format(elpa_include), - '--with-elpa-lib={0}'.format(elpa.libs[0]) + '--with-elpa-version={0}'.format(elpa.version.version[0]), ]) + elpa_suffix = '_openmp' if '+openmp' in elpa else '' + + # Currently AOCC support only static libraries of ELPA + if '%aocc' in spec: + options.extend([ + '--with-elpa-lib={0}'.format( + join_path(elpa.prefix.lib, + 'libelpa{elpa_suffix}.a' + .format(elpa_suffix=elpa_suffix))) + ]) + else: + options.extend([ + '--with-elpa-lib={0}'.format(elpa.libs[0]) + ]) + if spec.variants['hdf5'].value != 'none': options.append('--with-hdf5={0}'.format(spec['hdf5'].prefix)) if spec.satisfies('@6.4.1,6.5'): |