abinit: make libxml2 really optional, add optimization-flavor variant, fix build with ifort for atompaw (#24876)

This commit is contained in:
Tiziano Müller 2021-07-20 05:57:54 +02:00 committed by GitHub
parent b8b8450400
commit 3a698112cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 31 deletions

View File

@ -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 @@ def configure_args(self):
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 @@ def configure_args(self):
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 @@ def check(self):
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')

View File

@ -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

View File

@ -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]