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:
parent
cd0524b5b7
commit
9115ab5097
@ -22,15 +22,13 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
import os
|
|
||||||
from spack import *
|
from spack import *
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def _verbs_dir():
|
def _verbs_dir():
|
||||||
"""
|
"""Try to find the directory where the OpenFabrics verbs package is
|
||||||
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:
|
||||||
# Try to locate Verbs by looking for a utility in the path
|
# Try to locate Verbs by looking for a utility in the path
|
||||||
ibv_devices = which("ibv_devices")
|
ibv_devices = which("ibv_devices")
|
||||||
@ -46,7 +44,7 @@ def _verbs_dir():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Openmpi(Package):
|
class Openmpi(AutotoolsPackage):
|
||||||
"""The Open MPI Project is an open source Message Passing Interface
|
"""The Open MPI Project is an open source Message Passing Interface
|
||||||
implementation that is developed and maintained by a consortium
|
implementation that is developed and maintained by a consortium
|
||||||
of academic, research, and industry partners. Open MPI is
|
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('llnl-platforms.patch', when="@1.6.5")
|
||||||
patch('configure.patch', when="@1.10.0:1.10.1")
|
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,
|
variant('psm2', default=False,
|
||||||
description='Build support for the Intel PSM2 library.')
|
description='Build support for the Intel PSM2 library')
|
||||||
variant('pmi', default=False,
|
variant('pmi', default=False,
|
||||||
description='Build support for PMI-based launchers')
|
description='Build support for PMI-based launchers')
|
||||||
variant('verbs', default=_verbs_dir() is not None,
|
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('mxm', default=False, description='Build Mellanox Messaging support')
|
||||||
|
|
||||||
variant('thread_multiple', default=False,
|
# Schedulers
|
||||||
description='Enable MPI_THREAD_MULTIPLE support')
|
# TODO: support for alps and loadleveler is missing
|
||||||
|
|
||||||
# TODO : variant support for alps, loadleveler is missing
|
|
||||||
variant('tm', default=False,
|
variant('tm', default=False,
|
||||||
description='Build TM (Torque, PBSPro, and compatible) support')
|
description='Build TM (Torque, PBSPro, and compatible) support')
|
||||||
variant('slurm', default=False,
|
variant('slurm', default=False,
|
||||||
description='Build SLURM scheduler component')
|
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,
|
# TODO: support for CUDA is missing
|
||||||
description='Build support for contributed package vt')
|
|
||||||
|
|
||||||
# TODO : support for CUDA is missing
|
|
||||||
|
|
||||||
provides('mpi@:2.2', when='@1.6.5')
|
provides('mpi@:2.2', when='@1.6.5')
|
||||||
provides('mpi@:3.0', when='@1.7.5:')
|
provides('mpi@:3.0', when='@1.7.5:')
|
||||||
provides('mpi@:3.1', when='@2.0.0:')
|
provides('mpi@:3.1', when='@2.0.0:')
|
||||||
|
|
||||||
depends_on('hwloc')
|
depends_on('hwloc')
|
||||||
|
depends_on('jdk', when='+java')
|
||||||
depends_on('sqlite', when='+sqlite3')
|
depends_on('sqlite', when='+sqlite3')
|
||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
@ -142,63 +142,101 @@ def verbs(self):
|
|||||||
elif self.spec.satisfies('@1.7:'):
|
elif self.spec.satisfies('@1.7:'):
|
||||||
return 'verbs'
|
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
|
# 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('OpenMPI requires both C and Fortran ',
|
raise InstallError(
|
||||||
'compilers!')
|
'OpenMPI requires both C and Fortran compilers!'
|
||||||
|
)
|
||||||
|
|
||||||
config_args = ["--prefix=%s" % prefix,
|
def configure_args(self):
|
||||||
"--with-hwloc=%s" % spec['hwloc'].prefix,
|
spec = self.spec
|
||||||
"--enable-shared",
|
|
||||||
"--enable-static"]
|
|
||||||
|
|
||||||
# for Open-MPI 2.0:, C++ bindings are disabled by default.
|
config_args = [
|
||||||
if self.spec.satisfies('@2.0:'):
|
'--enable-shared',
|
||||||
config_args.extend(['--enable-mpi-cxx'])
|
'--enable-static',
|
||||||
|
'--enable-mpi-cxx',
|
||||||
if getattr(self, 'config_extra', None) is not None:
|
|
||||||
config_args.extend(self.config_extra)
|
|
||||||
|
|
||||||
# Variant based arguments
|
|
||||||
config_args.extend([
|
|
||||||
# Schedulers
|
# Schedulers
|
||||||
'--with-tm' if '+tm' in spec else '--without-tm',
|
'--with-tm' if '+tm' in spec else '--without-tm',
|
||||||
'--with-slurm' if '+slurm' in spec else '--without-slurm',
|
'--with-slurm' if '+slurm' in spec else '--without-slurm',
|
||||||
# Fabrics
|
# Fabrics
|
||||||
'--with-psm' if '+psm' in spec else '--without-psm',
|
'--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
|
# Intel PSM2 support
|
||||||
('--enable-mpi-thread-multiple' if '+thread_multiple' in spec
|
if spec.satisfies('@1.10:'):
|
||||||
else '--disable-mpi-thread-multiple'),
|
if '+psm2' in spec:
|
||||||
'--with-pmi' if '+pmi' in spec else '--without-pmi',
|
config_args.append('--with-psm2')
|
||||||
'--with-sqlite3' if '+sqlite3' in spec else '--without-sqlite3',
|
else:
|
||||||
'--enable-vt' if '+vt' in spec else '--disable-vt'
|
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:
|
if '+verbs' in spec:
|
||||||
path = _verbs_dir()
|
path = _verbs_dir()
|
||||||
if path is not None and path not in ('/usr', '/usr/local'):
|
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:
|
else:
|
||||||
config_args.append('--with-%s' % self.verbs)
|
config_args.append('--with-{0}'.format(self.verbs))
|
||||||
else:
|
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.
|
# Hwloc support
|
||||||
# use this for LANL builds, but for LLNL builds, we need:
|
if spec.satisfies('@1.5.2:'):
|
||||||
# "--with-platform=contrib/platform/llnl/optimized"
|
config_args.append('--with-hwloc={0}'.format(spec['hwloc'].prefix))
|
||||||
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
|
|
||||||
|
|
||||||
configure(*config_args)
|
# Java support
|
||||||
make()
|
if spec.satisfies('@1.7.4:'):
|
||||||
make("install")
|
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):
|
def filter_compilers(self):
|
||||||
"""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.
|
||||||
|
Loading…
Reference in New Issue
Block a user