Multi-valued variants (#2386)
Modifications: - added support for multi-valued variants - refactored code related to variants into variant.py - added new generic features to AutotoolsPackage that leverage multi-valued variants - modified openmpi to use new features - added unit tests for the new semantics
This commit is contained in:

committed by
Todd Gamblin

parent
5d0d670b72
commit
9e4b0eb34a
@@ -22,13 +22,16 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
|
||||
import os
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
def _verbs_dir():
|
||||
"""Try to find the directory where the OpenFabrics verbs package is
|
||||
installed. Return None if not found."""
|
||||
installed. Return None if not found.
|
||||
"""
|
||||
try:
|
||||
# Try to locate Verbs by looking for a utility in the path
|
||||
ibv_devices = which("ibv_devices")
|
||||
@@ -43,7 +46,7 @@ def _verbs_dir():
|
||||
if path == "/":
|
||||
path = "/usr"
|
||||
return path
|
||||
except:
|
||||
except TypeError:
|
||||
return None
|
||||
|
||||
|
||||
@@ -82,22 +85,20 @@ class Openmpi(AutotoolsPackage):
|
||||
patch('configure.patch', when="@1.10.0:1.10.1")
|
||||
patch('fix_multidef_pmi_class.patch', when="@2.0.0:2.0.1")
|
||||
|
||||
# Fabrics
|
||||
variant('psm', default=False, description='Build support for the PSM library')
|
||||
variant('psm2', default=False,
|
||||
description='Build support for the Intel PSM2 library')
|
||||
variant('pmi', default=False,
|
||||
description='Build support for PMI-based launchers')
|
||||
variant('verbs', default=_verbs_dir() is not None,
|
||||
description='Build support for OpenFabrics verbs')
|
||||
variant('mxm', default=False, description='Build Mellanox Messaging support')
|
||||
variant(
|
||||
'fabrics',
|
||||
default=None if _verbs_dir() is None else 'verbs',
|
||||
description='List of fabrics that are enabled',
|
||||
values=('psm', 'psm2', 'pmi', 'verbs', 'mxm'),
|
||||
multi=True
|
||||
)
|
||||
|
||||
# Schedulers
|
||||
# TODO: support for alps and loadleveler is missing
|
||||
variant('tm', default=False,
|
||||
description='Build TM (Torque, PBSPro, and compatible) support')
|
||||
variant('slurm', default=False,
|
||||
description='Build SLURM scheduler component')
|
||||
variant(
|
||||
'schedulers',
|
||||
description='List of schedulers for which support is enabled',
|
||||
values=('alps', 'lsf', 'tm', 'slurm', 'sge', 'loadleveler'),
|
||||
multi=True
|
||||
)
|
||||
|
||||
# Additional support options
|
||||
variant('java', default=False, description='Build Java support')
|
||||
@@ -114,7 +115,7 @@ class Openmpi(AutotoolsPackage):
|
||||
depends_on('hwloc')
|
||||
depends_on('hwloc +cuda', when='+cuda')
|
||||
depends_on('jdk', when='+java')
|
||||
depends_on('sqlite', when='+sqlite3')
|
||||
depends_on('sqlite', when='+sqlite3@:1.11')
|
||||
|
||||
def url_for_version(self, version):
|
||||
return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % (
|
||||
@@ -153,15 +154,22 @@ def setup_dependent_package(self, module, dependent_spec):
|
||||
join_path(self.prefix.lib, 'libmpi.{0}'.format(dso_suffix))
|
||||
]
|
||||
|
||||
@property
|
||||
def verbs(self):
|
||||
def with_or_without_verbs(self, activated):
|
||||
# Up through version 1.6, this option was previously named
|
||||
# --with-openib
|
||||
if self.spec.satisfies('@:1.6'):
|
||||
return 'openib'
|
||||
opt = 'openib'
|
||||
# In version 1.7, it was renamed to be --with-verbs
|
||||
elif self.spec.satisfies('@1.7:'):
|
||||
return 'verbs'
|
||||
if self.spec.satisfies('@1.7:'):
|
||||
opt = 'verbs'
|
||||
# If the option has not been activated return
|
||||
# --without-openib or --without-verbs
|
||||
if not activated:
|
||||
return '--without-{0}'.format(opt)
|
||||
line = '--with-{0}'.format(opt)
|
||||
path = _verbs_dir()
|
||||
if (path is not None) and (path not in ('/usr', '/usr/local')):
|
||||
line += '={0}'.format(path)
|
||||
return line
|
||||
|
||||
@run_before('autoreconf')
|
||||
def die_without_fortran(self):
|
||||
@@ -175,48 +183,17 @@ def die_without_fortran(self):
|
||||
|
||||
def configure_args(self):
|
||||
spec = self.spec
|
||||
|
||||
config_args = [
|
||||
'--enable-shared',
|
||||
'--enable-static',
|
||||
'--enable-mpi-cxx',
|
||||
# Schedulers
|
||||
'--with-tm' if '+tm' in spec else '--without-tm',
|
||||
'--with-slurm' if '+slurm' in spec else '--without-slurm',
|
||||
# Fabrics
|
||||
'--with-psm' if '+psm' in spec else '--without-psm',
|
||||
'--enable-static'
|
||||
]
|
||||
if self.spec.satisfies('@2.0:'):
|
||||
# for Open-MPI 2.0:, C++ bindings are disabled by default.
|
||||
config_args.extend(['--enable-mpi-cxx'])
|
||||
|
||||
# Intel PSM2 support
|
||||
if spec.satisfies('@1.10:'):
|
||||
if '+psm2' in spec:
|
||||
config_args.append('--with-psm2')
|
||||
else:
|
||||
config_args.append('--without-psm2')
|
||||
|
||||
# PMI support
|
||||
if spec.satisfies('@1.5.5:'):
|
||||
if '+pmi' in spec:
|
||||
config_args.append('--with-pmi')
|
||||
else:
|
||||
config_args.append('--without-pmi')
|
||||
|
||||
# Mellanox Messaging support
|
||||
if spec.satisfies('@1.5.4:'):
|
||||
if '+mxm' in spec:
|
||||
config_args.append('--with-mxm')
|
||||
else:
|
||||
config_args.append('--without-mxm')
|
||||
|
||||
# OpenFabrics verbs support
|
||||
if '+verbs' in spec:
|
||||
path = _verbs_dir()
|
||||
if path is not None and path not in ('/usr', '/usr/local'):
|
||||
config_args.append('--with-{0}={1}'.format(self.verbs, path))
|
||||
else:
|
||||
config_args.append('--with-{0}'.format(self.verbs))
|
||||
else:
|
||||
config_args.append('--without-{0}'.format(self.verbs))
|
||||
# Fabrics and schedulers
|
||||
config_args.extend(self.with_or_without('fabrics'))
|
||||
config_args.extend(self.with_or_without('schedulers'))
|
||||
|
||||
# Hwloc support
|
||||
if spec.satisfies('@1.5.2:'):
|
||||
@@ -270,11 +247,11 @@ def configure_args(self):
|
||||
@run_after('install')
|
||||
def filter_compilers(self):
|
||||
"""Run after install to make the MPI compilers use the
|
||||
compilers that Spack built the package with.
|
||||
compilers that Spack built the package with.
|
||||
|
||||
If this isn't done, they'll have CC, CXX and FC set
|
||||
to Spack's generic cc, c++ and f90. We want them to
|
||||
be bound to whatever compiler they were built with.
|
||||
If this isn't done, they'll have CC, CXX and FC set
|
||||
to Spack's generic cc, c++ and f90. We want them to
|
||||
be bound to whatever compiler they were built with.
|
||||
"""
|
||||
kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
|
||||
wrapper_basepath = join_path(self.prefix, 'share', 'openmpi')
|
||||
|
Reference in New Issue
Block a user