abinit: make libxml2 really optional, add optimization-flavor variant, fix build with ifort for atompaw (#24876)
This commit is contained in:
		| @@ -51,6 +51,10 @@ class Abinit(AutotoolsPackage): | |||||||
|     variant('libxml2', default=False, |     variant('libxml2', default=False, | ||||||
|             description='Enable libxml2 support, used by multibinit') |             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 |     # Add dependencies | ||||||
|     depends_on('atompaw') |     depends_on('atompaw') | ||||||
|     depends_on('blas') |     depends_on('blas') | ||||||
| @@ -75,7 +79,7 @@ class Abinit(AutotoolsPackage): | |||||||
|     depends_on('libxc@:2', when='@:8') |     depends_on('libxc@:2', when='@:8') | ||||||
| 
 | 
 | ||||||
|     # libxml2 |     # libxml2 | ||||||
|     depends_on('libxml2', when='@9:') |     depends_on('libxml2', when='@9:+libxml2') | ||||||
| 
 | 
 | ||||||
|     # Cannot ask for +scalapack if it does not depend on MPI |     # Cannot ask for +scalapack if it does not depend on MPI | ||||||
|     conflicts('+scalapack', when='~mpi') |     conflicts('+scalapack', when='~mpi') | ||||||
| @@ -122,6 +126,8 @@ def configure_args(self): | |||||||
|         options += self.with_or_without('libxml2') |         options += self.with_or_without('libxml2') | ||||||
| 
 | 
 | ||||||
|         oapp = options.append |         oapp = options.append | ||||||
|  |         oapp('--with-optim-flavor={0}' | ||||||
|  |              .format(self.spec.variants['optimization-flavor'].value)) | ||||||
| 
 | 
 | ||||||
|         if '+wannier90' in spec: |         if '+wannier90' in spec: | ||||||
|             if '@:8' in spec: |             if '@:8' in spec: | ||||||
| @@ -190,49 +196,39 @@ def configure_args(self): | |||||||
| 
 | 
 | ||||||
|         oapp('--with-linalg-flavor={0}'.format(linalg_flavor)) |         oapp('--with-linalg-flavor={0}'.format(linalg_flavor)) | ||||||
| 
 | 
 | ||||||
|         # FFTW3: use sequential from fftw3 or MKL |         if '^mkl' in spec: | ||||||
|         if '@:8' in spec: |             fftflavor = 'dfti' | ||||||
|  |         elif '^fftw' in spec: | ||||||
|             if '+openmp' in spec: |             if '+openmp' in spec: | ||||||
|                 fftflavor, fftlibs = 'fftw3-threads', '-lfftw3_omp -lfftw3 -lfftw3f' |                 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([ |                 options.extend([ | ||||||
|                     '--with-fft-incs={0}'.format(spec['fftw'].headers.cpp_flags), |                     '--with-fft-incs={0}'.format(spec['fftw'].headers.cpp_flags), | ||||||
|                     '--with-fft-libs=-L{0} {1}'.format( |                     '--with-fft-libs=-L{0} {1}'.format( | ||||||
|                         spec['fftw'].prefix.lib, fftlibs), |                         spec['fftw'].prefix.lib, fftlibs), | ||||||
|                 ]) |                 ]) | ||||||
|         else: |         else: | ||||||
|                 oapp('--with-fft-incs={0}'.format(spec['fftw-api'].headers.cpp_flags)) |  | ||||||
|             if '^mkl' in spec: |             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' |  | ||||||
|                 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([ |                 options.extend([ | ||||||
|                     'FFT_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), |                     'FFT_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), | ||||||
|                     'FFT_LIBs={0}'.format(spec['fftw-api'].libs.ld_flags), |                     'FFT_LIBs={0}'.format(spec['fftw-api'].libs.ld_flags), | ||||||
|                 ]) |                 ]) | ||||||
|             elif '^fftw' in spec: |             elif '^fftw' in spec: | ||||||
|                     fftflavor, fftlibs = 'fftw3', '-lfftw3 -lfftw3f' |  | ||||||
|                 options.extend([ |                 options.extend([ | ||||||
|                         'FFTW3_CPPFLAGS={0}'.format(spec['fftw-api'].headers.cpp_flags), |                     'FFTW3_CPPFLAGS={0}'.format(spec['fftw'].headers.cpp_flags), | ||||||
|                     'FFTW3_LIBS=-L{0} {1}'.format( |                     'FFTW3_LIBS=-L{0} {1}'.format( | ||||||
|                             spec['fftw-api'].prefix.lib, fftlibs), |                         spec['fftw'].prefix.lib, fftlibs), | ||||||
|                 ]) |                 ]) | ||||||
| 
 | 
 | ||||||
|         oapp('--with-fft-flavor={0}'.format(fftflavor)) |  | ||||||
| 
 |  | ||||||
|         # LibXC library |         # LibXC library | ||||||
|         libxc = spec['libxc:fortran'] |         libxc = spec['libxc:fortran'] | ||||||
|         if '@:8' in spec: |         if '@:8' in spec: | ||||||
| @@ -274,4 +270,9 @@ def check(self): | |||||||
|         explicitly activated by user. |         explicitly activated by user. | ||||||
|         """ |         """ | ||||||
|         make('check') |         make('check') | ||||||
|  | 
 | ||||||
|  |         # 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') |             make('tests_in') | ||||||
|   | |||||||
| @@ -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 | ||||||
| @@ -29,6 +29,8 @@ class Atompaw(Package): | |||||||
|     depends_on('libxc') |     depends_on('libxc') | ||||||
|     depends_on('libxc@:2', when='@:4.0') |     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): |     def install(self, spec, prefix): | ||||||
|         options = ['--prefix=%s' % prefix] |         options = ['--prefix=%s' % prefix] | ||||||
| 
 | 
 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tiziano Müller
					Tiziano Müller