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>
This commit is contained in:
parent
01f8236bf5
commit
4a8db00691
2 changed files with 40 additions and 26 deletions
|
@ -19,51 +19,58 @@ class Nfft(AutotoolsPackage):
|
||||||
|
|
||||||
depends_on('fftw')
|
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):
|
def configure(self, spec, prefix):
|
||||||
options = ['--prefix={0}'.format(prefix)]
|
options = ['--prefix={0}'.format(prefix)]
|
||||||
|
|
||||||
configure = Executable('../configure')
|
configure = Executable('../configure')
|
||||||
|
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double', create=True):
|
with working_dir('double', create=True):
|
||||||
configure(*options)
|
configure(*options)
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float', create=True):
|
with working_dir('float', create=True):
|
||||||
configure('--enable-float', *options)
|
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):
|
with working_dir('long-double', create=True):
|
||||||
configure('--enable-long-double', *options)
|
configure('--enable-long-double', *options)
|
||||||
|
|
||||||
def build(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make()
|
make()
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make()
|
make()
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make()
|
make()
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
spec = self.spec
|
if 'double' in self.fftw_selected_precisions:
|
||||||
if '+double' in spec['fftw']:
|
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make("check")
|
make("check")
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make("check")
|
make("check")
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make("check")
|
make("check")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make("install")
|
make("install")
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make("install")
|
make("install")
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make("install")
|
make("install")
|
||||||
|
|
|
@ -18,6 +18,14 @@ class Pnfft(AutotoolsPackage):
|
||||||
depends_on('pfft')
|
depends_on('pfft')
|
||||||
depends_on('gsl')
|
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):
|
def configure(self, spec, prefix):
|
||||||
options = ['--prefix={0}'.format(prefix)]
|
options = ['--prefix={0}'.format(prefix)]
|
||||||
if not self.compiler.f77 or not self.compiler.fc:
|
if not self.compiler.f77 or not self.compiler.fc:
|
||||||
|
@ -25,46 +33,45 @@ def configure(self, spec, prefix):
|
||||||
|
|
||||||
configure = Executable('../configure')
|
configure = Executable('../configure')
|
||||||
|
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double', create=True):
|
with working_dir('double', create=True):
|
||||||
configure(*options)
|
configure(*options)
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float', create=True):
|
with working_dir('float', create=True):
|
||||||
configure('--enable-float', *options)
|
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):
|
with working_dir('long-double', create=True):
|
||||||
configure('--enable-long-double', *options)
|
configure('--enable-long-double', *options)
|
||||||
|
|
||||||
def build(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make()
|
make()
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make()
|
make()
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make()
|
make()
|
||||||
|
|
||||||
def check(self):
|
def check(self):
|
||||||
spec = self.spec
|
if 'double' in self.fftw_selected_precisions:
|
||||||
if '+double' in spec['fftw']:
|
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make("check")
|
make("check")
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make("check")
|
make("check")
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make("check")
|
make("check")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
if '+double' in spec['fftw']:
|
if 'double' in self.fftw_selected_precisions:
|
||||||
with working_dir('double'):
|
with working_dir('double'):
|
||||||
make("install")
|
make("install")
|
||||||
if '+float' in spec['fftw']:
|
if 'float' in self.fftw_selected_precisions:
|
||||||
with working_dir('float'):
|
with working_dir('float'):
|
||||||
make("install")
|
make("install")
|
||||||
if '+long_double' in spec['fftw']:
|
if 'long_double' in self.fftw_selected_precisions:
|
||||||
with working_dir('long-double'):
|
with working_dir('long-double'):
|
||||||
make("install")
|
make("install")
|
||||||
|
|
Loading…
Reference in a new issue