diff options
author | Martin Lang <67915889+lang-m@users.noreply.github.com> | 2022-06-09 17:47:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 08:47:12 -0700 |
commit | 4a8db0069186f2bb47198ef868131b6ea075323f (patch) | |
tree | 57a1c86abf2e2bbffc897cac3cf276b6710e457d /var | |
parent | 01f8236bf5faca20859ed3c4bb7dd179a4178e18 (diff) | |
download | spack-4a8db0069186f2bb47198ef868131b6ea075323f.tar.gz spack-4a8db0069186f2bb47198ef868131b6ea075323f.tar.bz2 spack-4a8db0069186f2bb47198ef868131b6ea075323f.tar.xz spack-4a8db0069186f2bb47198ef868131b6ea075323f.zip |
nfft, pnfft: fix detection of fftw variants (precision) (#30935)
* nfft, pnfft: fix detection of fftw variants (precision)
* nfft, pnfft: use fftw's selected_precisions; avoid repetitive calls to spec
Co-authored-by: Martin Lang <martin.lang@mpsd.mpg.de>
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/nfft/package.py | 33 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/pnfft/package.py | 33 |
2 files changed, 40 insertions, 26 deletions
diff --git a/var/spack/repos/builtin/packages/nfft/package.py b/var/spack/repos/builtin/packages/nfft/package.py index 549b4a5f25..eeab2da0d6 100644 --- a/var/spack/repos/builtin/packages/nfft/package.py +++ b/var/spack/repos/builtin/packages/nfft/package.py @@ -19,51 +19,58 @@ class Nfft(AutotoolsPackage): depends_on('fftw') + _fftw_precisions = None + + @property + def fftw_selected_precisions(self): + if not self._fftw_precisions: + self._fftw_precisions = self.spec['fftw'].package.selected_precisions + return self._fftw_precisions + def configure(self, spec, prefix): options = ['--prefix={0}'.format(prefix)] configure = Executable('../configure') - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double', create=True): configure(*options) - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float', create=True): configure('--enable-float', *options) - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double', create=True): configure('--enable-long-double', *options) def build(self, spec, prefix): - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make() - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make() - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make() def check(self): - spec = self.spec - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make("check") - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make("check") - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make("check") def install(self, spec, prefix): - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make("install") - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make("install") - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make("install") diff --git a/var/spack/repos/builtin/packages/pnfft/package.py b/var/spack/repos/builtin/packages/pnfft/package.py index cb1d14c9ef..180b06bb5a 100644 --- a/var/spack/repos/builtin/packages/pnfft/package.py +++ b/var/spack/repos/builtin/packages/pnfft/package.py @@ -18,6 +18,14 @@ class Pnfft(AutotoolsPackage): depends_on('pfft') depends_on('gsl') + _fftw_precisions = None + + @property + def fftw_selected_precisions(self): + if not self._fftw_precisions: + self._fftw_precisions = self.spec['fftw'].package.selected_precisions + return self._fftw_precisions + def configure(self, spec, prefix): options = ['--prefix={0}'.format(prefix)] if not self.compiler.f77 or not self.compiler.fc: @@ -25,46 +33,45 @@ class Pnfft(AutotoolsPackage): configure = Executable('../configure') - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double', create=True): configure(*options) - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float', create=True): configure('--enable-float', *options) - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double', create=True): configure('--enable-long-double', *options) def build(self, spec, prefix): - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make() - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make() - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make() def check(self): - spec = self.spec - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make("check") - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make("check") - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make("check") def install(self, spec, prefix): - if '+double' in spec['fftw']: + if 'double' in self.fftw_selected_precisions: with working_dir('double'): make("install") - if '+float' in spec['fftw']: + if 'float' in self.fftw_selected_precisions: with working_dir('float'): make("install") - if '+long_double' in spec['fftw']: + if 'long_double' in self.fftw_selected_precisions: with working_dir('long-double'): make("install") |