mpich: updated package to build_systems (#2254)

* mpich: updated package to build_systems

* qa : flake8 issues
This commit is contained in:
Massimiliano Culpo 2016-11-05 19:23:57 +01:00 committed by Todd Gamblin
parent 1bef2b7e98
commit 6c1113769b

View File

@ -26,7 +26,7 @@
import os import os
class Mpich(Package): class Mpich(AutotoolsPackage):
"""MPICH is a high performance and widely portable implementation of """MPICH is a high performance and widely portable implementation of
the Message Passing Interface (MPI) standard.""" the Message Passing Interface (MPI) standard."""
@ -81,16 +81,19 @@ def setup_dependent_package(self, module, dep_spec):
join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix)) join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
] ]
def install(self, spec, prefix): @AutotoolsPackage.precondition('autoreconf')
def die_without_fortran(self):
# Until we can pass variants such as +fortran through virtual # Until we can pass variants such as +fortran through virtual
# dependencies depends_on('mpi'), require Fortran compiler to # dependencies depends_on('mpi'), require Fortran compiler to
# avoid delayed build errors in dependents. # avoid delayed build errors in dependents.
if (self.compiler.f77 is None) or (self.compiler.fc is None): if (self.compiler.f77 is None) or (self.compiler.fc is None):
raise InstallError('Mpich requires both C and Fortran ', raise InstallError(
'compilers!') 'Mpich requires both C and Fortran compilers!'
)
config_args = [ def configure_args(self):
'--prefix={0}'.format(prefix), spec = self.spec
return [
'--enable-shared', '--enable-shared',
'--with-pm={0}'.format('hydra' if '+hydra' in spec else 'no'), '--with-pm={0}'.format('hydra' if '+hydra' in spec else 'no'),
'--with-pmi={0}'.format('yes' if '+pmi' in spec else 'no'), '--with-pmi={0}'.format('yes' if '+pmi' in spec else 'no'),
@ -98,27 +101,8 @@ def install(self, spec, prefix):
'--{0}-ibverbs'.format('with' if '+verbs' in spec else 'without') '--{0}-ibverbs'.format('with' if '+verbs' in spec else 'without')
] ]
# TODO: Spack should make it so that you can't actually find @AutotoolsPackage.sanity_check('install')
# these compilers if they're "disabled" for the current def filter_compilers(self):
# compiler configuration.
if not self.compiler.f77:
config_args.append("--disable-f77")
if not self.compiler.fc:
config_args.append("--disable-fc")
if not self.compiler.fc and not self.compiler.f77:
config_args.append("--disable-fortran")
configure(*config_args)
make()
make('check')
make('install')
self.filter_compilers(prefix)
def filter_compilers(self, prefix):
"""Run after install to make the MPI compilers use the """Run after install to make the MPI compilers use the
compilers that Spack built the package with. compilers that Spack built the package with.
@ -126,14 +110,18 @@ def filter_compilers(self, prefix):
to Spack's generic cc, c++, f77, and f90. We want them to to Spack's generic cc, c++, f77, and f90. We want them to
be bound to whatever compiler they were built with.""" be bound to whatever compiler they were built with."""
mpicc = join_path(prefix.bin, 'mpicc') mpicc = join_path(self.prefix.bin, 'mpicc')
mpicxx = join_path(prefix.bin, 'mpicxx') mpicxx = join_path(self.prefix.bin, 'mpicxx')
mpif77 = join_path(prefix.bin, 'mpif77') mpif77 = join_path(self.prefix.bin, 'mpif77')
mpif90 = join_path(prefix.bin, 'mpif90') mpif90 = join_path(self.prefix.bin, 'mpif90')
# Substitute Spack compile wrappers for the real # Substitute Spack compile wrappers for the real
# underlying compiler # underlying compiler
kwargs = {'ignore_absent': True, 'backup': False, 'string': True} kwargs = {
'ignore_absent': True,
'backup': False,
'string': True
}
filter_file(env['CC'], self.compiler.cc, mpicc, **kwargs) filter_file(env['CC'], self.compiler.cc, mpicc, **kwargs)
filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs) filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs)
filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs) filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs)