Add Java support to OpenMPI (#2285)

* Update OpenMPI to the AutotoolsPackage

* Add Java support to OpenMPI

* Fix missing commas

* Be more specific about what versions support what flags

* Revert description for thread_multiple variant
This commit is contained in:
Adam J. Stewart 2016-12-05 12:15:12 -06:00 committed by Todd Gamblin
parent cd0524b5b7
commit 9115ab5097

View file

@ -22,15 +22,13 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
from spack import *
import os
def _verbs_dir():
"""
Try to find the directory where the OpenFabrics verbs package is
installed. Return None if not found.
"""
"""Try to find the directory where the OpenFabrics verbs package is
installed. Return None if not found."""
try:
# Try to locate Verbs by looking for a utility in the path
ibv_devices = which("ibv_devices")
@ -46,7 +44,7 @@ def _verbs_dir():
return None
class Openmpi(Package):
class Openmpi(AutotoolsPackage):
"""The Open MPI Project is an open source Message Passing Interface
implementation that is developed and maintained by a consortium
of academic, research, and industry partners. Open MPI is
@ -75,36 +73,38 @@ class Openmpi(Package):
patch('llnl-platforms.patch', when="@1.6.5")
patch('configure.patch', when="@1.10.0:1.10.1")
variant('psm', default=False, description='Build support for the PSM library.')
# Fabrics
variant('psm', default=False, description='Build support for the PSM library')
variant('psm2', default=False,
description='Build support for the Intel PSM2 library.')
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.')
description='Build support for OpenFabrics verbs')
variant('mxm', default=False, description='Build Mellanox Messaging support')
variant('thread_multiple', default=False,
description='Enable MPI_THREAD_MULTIPLE support')
# TODO : variant support for alps, loadleveler is missing
# 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('sqlite3', default=False, description='Build sqlite3 support')
# Additional support options
variant('java', default=False, description='Build Java support')
variant('sqlite3', default=False, description='Build SQLite3 support')
variant('vt', default=True, description='Build VampirTrace support')
variant('thread_multiple', default=False,
description='Enable MPI_THREAD_MULTIPLE support')
variant('vt', default=True,
description='Build support for contributed package vt')
# TODO : support for CUDA is missing
# TODO: support for CUDA is missing
provides('mpi@:2.2', when='@1.6.5')
provides('mpi@:3.0', when='@1.7.5:')
provides('mpi@:3.1', when='@2.0.0:')
depends_on('hwloc')
depends_on('jdk', when='+java')
depends_on('sqlite', when='+sqlite3')
def url_for_version(self, version):
@ -142,63 +142,101 @@ def verbs(self):
elif self.spec.satisfies('@1.7:'):
return 'verbs'
def install(self, spec, prefix):
@AutotoolsPackage.precondition('autoreconf')
def die_without_fortran(self):
# Until we can pass variants such as +fortran through virtual
# dependencies depends_on('mpi'), require Fortran compiler to
# avoid delayed build errors in dependents.
if (self.compiler.f77 is None) or (self.compiler.fc is None):
raise InstallError('OpenMPI requires both C and Fortran ',
'compilers!')
raise InstallError(
'OpenMPI requires both C and Fortran compilers!'
)
config_args = ["--prefix=%s" % prefix,
"--with-hwloc=%s" % spec['hwloc'].prefix,
"--enable-shared",
"--enable-static"]
def configure_args(self):
spec = self.spec
# for Open-MPI 2.0:, C++ bindings are disabled by default.
if self.spec.satisfies('@2.0:'):
config_args.extend(['--enable-mpi-cxx'])
if getattr(self, 'config_extra', None) is not None:
config_args.extend(self.config_extra)
# Variant based arguments
config_args.extend([
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',
'--with-psm2' if '+psm2' in spec else '--without-psm2',
'--with-mxm' if '+mxm' in spec else '--without-mxm',
# Other options
('--enable-mpi-thread-multiple' if '+thread_multiple' in spec
else '--disable-mpi-thread-multiple'),
'--with-pmi' if '+pmi' in spec else '--without-pmi',
'--with-sqlite3' if '+sqlite3' in spec else '--without-sqlite3',
'--enable-vt' if '+vt' in spec else '--disable-vt'
])
]
# 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-%s=%s' % (self.verbs, path))
config_args.append('--with-{0}={1}'.format(self.verbs, path))
else:
config_args.append('--with-%s' % self.verbs)
config_args.append('--with-{0}'.format(self.verbs))
else:
config_args.append('--without-%s' % self.verbs)
config_args.append('--without-{0}'.format(self.verbs))
# TODO: use variants for this, e.g. +lanl, +llnl, etc.
# use this for LANL builds, but for LLNL builds, we need:
# "--with-platform=contrib/platform/llnl/optimized"
if self.version == ver("1.6.5") and '+lanl' in spec:
config_args.append("--with-platform=contrib/platform/lanl/tlcc2/optimized-nopanasas") # NOQA: ignore=E501
# Hwloc support
if spec.satisfies('@1.5.2:'):
config_args.append('--with-hwloc={0}'.format(spec['hwloc'].prefix))
configure(*config_args)
make()
make("install")
# Java support
if spec.satisfies('@1.7.4:'):
if '+java' in spec:
config_args.extend([
'--enable-java',
'--enable-mpi-java',
'--with-jdk-dir={0}'.format(spec['jdk'].prefix)
])
else:
config_args.extend([
'--disable-java',
'--disable-mpi-java'
])
self.filter_compilers()
# SQLite3 support
if spec.satisfies('@1.7.3:1.999'):
if '+sqlite3' in spec:
config_args.append('--with-sqlite3')
else:
config_args.append('--without-sqlite3')
# VampirTrace support
if spec.satisfies('@1.3:1.999'):
if '+vt' not in spec:
config_args.append('--enable-contrib-no-build=vt')
# Multithreading support
if spec.satisfies('@1.5.4:'):
if '+thread_multiple' in spec:
config_args.append('--enable-mpi-thread-multiple')
else:
config_args.append('--disable-mpi-thread-multiple')
return config_args
@AutotoolsPackage.sanity_check('install')
def filter_compilers(self):
"""Run after install to make the MPI compilers use the
compilers that Spack built the package with.