diff options
author | Tiziano Müller <tiziano.mueller@chem.uzh.ch> | 2021-07-20 05:57:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 22:57:54 -0500 |
commit | 3a698112ccbbb2e87874a8af3e9f5b9d61bfb76d (patch) | |
tree | e3a0361edd954a38e66d524ddbca2bbc2a27a3c0 | |
parent | b8b8450400fa426e696caf0d461a331598fb6ec8 (diff) | |
download | spack-3a698112ccbbb2e87874a8af3e9f5b9d61bfb76d.tar.gz spack-3a698112ccbbb2e87874a8af3e9f5b9d61bfb76d.tar.bz2 spack-3a698112ccbbb2e87874a8af3e9f5b9d61bfb76d.tar.xz spack-3a698112ccbbb2e87874a8af3e9f5b9d61bfb76d.zip |
abinit: make libxml2 really optional, add optimization-flavor variant, fix build with ifort for atompaw (#24876)
3 files changed, 49 insertions, 31 deletions
diff --git a/var/spack/repos/builtin/packages/abinit/package.py b/var/spack/repos/builtin/packages/abinit/package.py index 39be0efd34..939118efa2 100644 --- a/var/spack/repos/builtin/packages/abinit/package.py +++ b/var/spack/repos/builtin/packages/abinit/package.py @@ -51,6 +51,10 @@ class Abinit(AutotoolsPackage): variant('libxml2', default=False, description='Enable libxml2 support, used by multibinit') + variant('optimization-flavor', default='standard', multi=False, + values=('safe', 'standard', 'aggressive'), + description='Select the optimization flavor to use.') + # Add dependencies depends_on('atompaw') depends_on('blas') @@ -75,7 +79,7 @@ class Abinit(AutotoolsPackage): depends_on('libxc@:2', when='@:8') # libxml2 - depends_on('libxml2', when='@9:') + depends_on('libxml2', when='@9:+libxml2') # Cannot ask for +scalapack if it does not depend on MPI conflicts('+scalapack', when='~mpi') @@ -122,6 +126,8 @@ class Abinit(AutotoolsPackage): options += self.with_or_without('libxml2') oapp = options.append + oapp('--with-optim-flavor={0}' + .format(self.spec.variants['optimization-flavor'].value)) if '+wannier90' in spec: if '@:8' in spec: @@ -190,48 +196,38 @@ class Abinit(AutotoolsPackage): oapp('--with-linalg-flavor={0}'.format(linalg_flavor)) - # FFTW3: use sequential from fftw3 or MKL - if '@:8' in spec: + if '^mkl' in spec: + fftflavor = 'dfti' + elif '^fftw' in spec: if '+openmp' in spec: fftflavor, fftlibs = 'fftw3-threads', '-lfftw3_omp -lfftw3 -lfftw3f' + else: + fftflavor, fftlibs = 'fftw3', '-lfftw3 -lfftw3f' + + oapp('--with-fft-flavor={0}'.format(fftflavor)) + + if '@:8' in spec: + if '^mkl' in spec: + oapp('--with-fft-incs={0}'.format(spec['fftw-api'].headers.cpp_flags)) + oapp('--with-fft-libs={0}'.format(spec['fftw-api'].libs.ld_flags)) + elif '^fftw' in spec: options.extend([ '--with-fft-incs={0}'.format(spec['fftw'].headers.cpp_flags), '--with-fft-libs=-L{0} {1}'.format( spec['fftw'].prefix.lib, fftlibs), ]) - else: - oapp('--with-fft-incs={0}'.format(spec['fftw-api'].headers.cpp_flags)) - if '^mkl' in spec: - fftflavor = 'dfti' - oapp('--with-fft-libs={0}'.format(spec['fftw-api'].libs.ld_flags)) - elif '^fftw' in spec: - fftflavor, fftlibs = 'fftw3', '-lfftw3 -lfftw3f' - oapp('--with-fft-libs=-L{0} {1}'.format( - spec['fftw-api'].prefix.lib, fftlibs)) else: - if '+openmp' in spec: - fftflavor, fftlibs = 'fftw3-threads', '-lfftw3_omp -lfftw3 -lfftw3f' + if '^mkl' in spec: + options.extend([ + 'FFT_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), + 'FFT_LIBs={0}'.format(spec['fftw-api'].libs.ld_flags), + ]) + elif '^fftw' in spec: options.extend([ 'FFTW3_CPPFLAGS={0}'.format(spec['fftw'].headers.cpp_flags), 'FFTW3_LIBS=-L{0} {1}'.format( spec['fftw'].prefix.lib, fftlibs), ]) - else: - if '^mkl' in spec: - fftflavor = 'dfti' - options.extend([ - 'FFT_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), - 'FFT_LIBs={0}'.format(spec['fftw-api'].libs.ld_flags), - ]) - elif '^fftw' in spec: - fftflavor, fftlibs = 'fftw3', '-lfftw3 -lfftw3f' - options.extend([ - 'FFTW3_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), - 'FFTW3_LIBS=-L{0} {1}'.format( - spec['fftw-api'].prefix.lib, fftlibs), - ]) - - oapp('--with-fft-flavor={0}'.format(fftflavor)) # LibXC library libxc = spec['libxc:fortran'] @@ -274,4 +270,9 @@ class Abinit(AutotoolsPackage): explicitly activated by user. """ make('check') - make('tests_in') + + # the tests directly execute abinit. thus failing with MPI + # TODO: run tests in tests/ via the builtin runtests.py + # requires Python with numpy, pyyaml, pandas + if '~mpi' in self.spec: + make('tests_in') diff --git a/var/spack/repos/builtin/packages/atompaw/atompaw-4.1.1.0-fix-ifort.patch b/var/spack/repos/builtin/packages/atompaw/atompaw-4.1.1.0-fix-ifort.patch new file mode 100644 index 0000000000..59ace7cb0f --- /dev/null +++ b/var/spack/repos/builtin/packages/atompaw/atompaw-4.1.1.0-fix-ifort.patch @@ -0,0 +1,15 @@ +diff --git a/src/io_tools.F90 b/src/io_tools.F90 +index fe94582..5da3abc 100644 +--- a/src/io_tools.F90 ++++ b/src/io_tools.F90 +@@ -8,7 +8,9 @@ + #endif
+
+ MODULE io_tools
+-
++#if defined (__INTEL_COMPILER)
++ USE IFPORT
++#endif
+ IMPLICIT NONE
+
+ PRIVATE
diff --git a/var/spack/repos/builtin/packages/atompaw/package.py b/var/spack/repos/builtin/packages/atompaw/package.py index ed4f7f6811..f7b2751634 100644 --- a/var/spack/repos/builtin/packages/atompaw/package.py +++ b/var/spack/repos/builtin/packages/atompaw/package.py @@ -29,6 +29,8 @@ class Atompaw(Package): depends_on('libxc') depends_on('libxc@:2', when='@:4.0') + patch('atompaw-4.1.1.0-fix-ifort.patch', when='@4.1.1.0:') + def install(self, spec, prefix): options = ['--prefix=%s' % prefix] |