summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/openmpi/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/openmpi/package.py')
-rw-r--r--var/spack/repos/builtin/packages/openmpi/package.py220
1 files changed, 139 insertions, 81 deletions
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index 5563198649..40ac79a2e8 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -1,29 +1,11 @@
-##############################################################################
-# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
-# Produced at the Lawrence Livermore National Laboratory.
+# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
-# This file is part of Spack.
-# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
-# LLNL-CODE-647188
-#
-# For details, see https://github.com/spack/spack
-# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License (as
-# published by the Free Software Foundation) version 2.1, February 1999.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
-# conditions of the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##############################################################################
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
import os
+import sys
from spack import *
@@ -65,27 +47,39 @@ def _mxm_dir():
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
- therefore able to combine the expertise, technologies, and
- resources from all across the High Performance Computing
- community in order to build the best MPI library available.
- Open MPI offers advantages for system and software vendors,
- application developers and computer science researchers.
+ """An open source Message Passing Interface implementation.
+
+ 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
+ therefore able to combine the expertise, technologies, and
+ resources from all across the High Performance Computing
+ community in order to build the best MPI library available.
+ Open MPI offers advantages for system and software vendors,
+ application developers and computer science researchers.
"""
homepage = "http://www.open-mpi.org"
- url = "https://www.open-mpi.org/software/ompi/v3.0/downloads/openmpi-3.0.0.tar.bz2"
+ url = "https://www.open-mpi.org/software/ompi/v3.1/downloads/openmpi-3.1.2.tar.bz2"
list_url = "http://www.open-mpi.org/software/ompi/"
# Current
- version('3.0.0', '757d51719efec08f9f1a7f32d58b3305') # libmpi.so.40.00.0
+ version('3.1.3', sha256='8be04307c00f51401d3fb9d837321781ea7c79f2a5a4a2e5d4eaedc874087ab6')
+ version('3.1.2', '210df69fafd964158527e7f37e333239') # libmpi.so.40.10.2
+ version('3.1.1', '493f1db2f75afaab1c8ecba78d2f5aab') # libmpi.so.40.10.1
+ version('3.1.0', '0895e268ca27735d7654bf64cee6c256') # libmpi.so.40.10.0
# Still supported
+ version('3.0.2', '098fa89646f5b4438d9d8534bc960cd6') # libmpi.so.40.00.2
+ version('3.0.1', '565f5060e080b0871a64b295c3d4426a') # libmpi.so.40.00.1
+ version('3.0.0', '757d51719efec08f9f1a7f32d58b3305') # libmpi.so.40.00.0
+ version('2.1.5', '6019c8b67d4975d833801e72ba290918') # libmpi.so.20.10.3
+ version('2.1.4', '003b356a24a5b7bd1705a23ddc69d9a0') # libmpi.so.20.10.3
+ version('2.1.3', '46079b6f898a412240a0bf523e6cd24b') # libmpi.so.20.10.2
version('2.1.2', 'ff2e55cc529802e7b0738cf87acd3ee4') # libmpi.so.20.10.2
version('2.1.1', 'ae542f5cf013943ffbbeb93df883731b') # libmpi.so.20.10.1
version('2.1.0', '4838a5973115c44e14442c01d3f21d52') # libmpi.so.20.10.0
+ version('2.0.4', '7e3c71563787a67dce9acc4d639ef3f8') # libmpi.so.20.0.4
version('2.0.3', '6c09e56ac2230c4f9abd8ba029f03edd') # libmpi.so.20.0.3
version('2.0.2', 'ecd99aa436a1ca69ce936a96d6a3fa48') # libmpi.so.20.0.2
version('2.0.1', '6f78155bd7203039d2448390f3b51c96') # libmpi.so.20.0.1
@@ -173,11 +167,21 @@ class Openmpi(AutotoolsPackage):
patch('configure.patch', when="@1.10.1")
patch('fix_multidef_pmi_class.patch', when="@2.0.0:2.0.1")
+ # Vader Bug: https://github.com/open-mpi/ompi/issues/5375
+ # Haven't release fix for 2.1.x
+ patch('btl_vader.patch', when='@2.1.3:2.1.5')
+
+ # Fixed in 3.0.3 and 3.1.3
+ patch('btl_vader.patch', when='@3.0.1:3.0.2')
+ patch('btl_vader.patch', when='@3.1.0:3.1.2')
+
+ fabrics = ('psm', 'psm2', 'verbs', 'mxm', 'ucx', 'libfabric')
+
variant(
'fabrics',
default=None if _verbs_dir() is None else 'verbs',
- description='List of fabrics that are enabled',
- values=('psm', 'psm2', 'pmi', 'verbs', 'mxm'),
+ description="List of fabrics that are enabled",
+ values=fabrics,
multi=True
)
@@ -195,27 +199,74 @@ class Openmpi(AutotoolsPackage):
variant('thread_multiple', default=False,
description='Enable MPI_THREAD_MULTIPLE support')
variant('cuda', default=False, description='Enable CUDA support')
+ variant('pmi', default=False, description='Enable PMI support')
+ variant('cxx_exceptions', default=True, description='Enable C++ Exception support')
+ # Adding support to build a debug version of OpenMPI that activates
+ # Memchecker, as described here:
+ #
+ # https://www.open-mpi.org/faq/?category=debugging#memchecker_what
+ #
+ # This option degrades run-time support, and thus is disabled by default
+ variant(
+ 'memchecker',
+ default=False,
+ description='Memchecker support for debugging [degrades performance]'
+ )
+
+ variant(
+ 'legacylaunchers',
+ default=False,
+ description='Do not remove mpirun/mpiexec when building with slurm'
+ )
provides('mpi')
provides('mpi@:2.2', when='@1.6.5')
provides('mpi@:3.0', when='@1.7.5:')
provides('mpi@:3.1', when='@2.0.0:')
+ if sys.platform != 'darwin':
+ depends_on('numactl')
+
depends_on('hwloc')
+ # ompi@:3.0.0 doesn't support newer hwloc releases:
+ # "configure: error: OMPI does not currently support hwloc v2 API"
+ # Future ompi releases may support it, needs to be verified.
+ # See #7483 for context.
+ depends_on('hwloc@:1.999')
+
depends_on('hwloc +cuda', when='+cuda')
depends_on('java', when='+java')
depends_on('sqlite', when='+sqlite3@:1.11')
+ depends_on('zlib', when='@3.0.0:')
+ depends_on('valgrind~mpi', when='+memchecker')
+ depends_on('ucx', when='fabrics=ucx')
+ depends_on('libfabric', when='fabrics=libfabric')
+ depends_on('slurm', when='schedulers=slurm')
+ depends_on('binutils+libiberty', when='fabrics=mxm')
conflicts('+cuda', when='@:1.6') # CUDA support was added in 1.7
conflicts('fabrics=psm2', when='@:1.8') # PSM2 support was added in 1.10.0
- conflicts('fabrics=pmi', when='@:1.5.4') # PMI support was added in 1.5.5
conflicts('fabrics=mxm', when='@:1.5.3') # MXM support was added in 1.5.4
+ conflicts('+pmi', when='@:1.5.4') # PMI support was added in 1.5.5
+ conflicts('schedulers=slurm ~pmi', when='@1.5.4:',
+ msg='+pmi is required for openmpi(>=1.5.5) to work with SLURM.')
+
+ filter_compiler_wrappers('openmpi/*-wrapper-data*', relative_root='share')
+ conflicts('fabrics=libfabric', when='@:1.8') # libfabric support was added in 1.10.0
+ # It may be worth considering making libfabric an exclusive fabrics choice
def url_for_version(self, version):
url = "http://www.open-mpi.org/software/ompi/v{0}/downloads/openmpi-{1}.tar.bz2"
return url.format(version.up_to(2), version)
@property
+ def headers(self):
+ hdrs = HeaderList(find(self.prefix.include, 'mpi.h', recursive=False))
+ if not hdrs:
+ hdrs = HeaderList(find(self.prefix, 'mpi.h', recursive=True))
+ return hdrs or None
+
+ @property
def libs(self):
query_parameters = self.spec.last_query.extra_parameters
libraries = ['libmpi']
@@ -224,7 +275,7 @@ class Openmpi(AutotoolsPackage):
libraries = ['libmpi_cxx'] + libraries
return find_libraries(
- libraries, root=self.prefix, shared=True, recurse=True
+ libraries, root=self.prefix, shared=True, recursive=True
)
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
@@ -290,16 +341,45 @@ class Openmpi(AutotoolsPackage):
spec = self.spec
config_args = [
'--enable-shared',
- '--enable-static'
]
- if self.spec.satisfies('@2.0:'):
+
+ # Add extra_rpaths dirs from compilers.yaml into link wrapper
+ rpaths = [self.compiler.cc_rpath_arg + path
+ for path in self.compiler.extra_rpaths]
+ config_args.extend([
+ '--with-wrapper-ldflags={0}'.format(' '.join(rpaths))
+ ])
+
+ # According to this comment on github:
+ #
+ # https://github.com/open-mpi/ompi/issues/4338#issuecomment-383982008
+ #
+ # adding --enable-static silently disables slurm support via pmi/pmi2
+ if spec.satisfies('schedulers=slurm'):
+ config_args.append('--with-pmi={0}'.format(spec['slurm'].prefix))
+ else:
+ config_args.append('--enable-static')
+ config_args.extend(self.with_or_without('pmi'))
+
+ if spec.satisfies('@2.0:'):
# for Open-MPI 2.0:, C++ bindings are disabled by default.
config_args.extend(['--enable-mpi-cxx'])
- # Fabrics and schedulers
+ if spec.satisfies('@3.0.0:', strict=True):
+ config_args.append('--with-zlib={0}'.format(spec['zlib'].prefix))
+
+ # Fabrics
config_args.extend(self.with_or_without('fabrics'))
+ # Schedulers
config_args.extend(self.with_or_without('schedulers'))
+ config_args.extend(self.enable_or_disable('memchecker'))
+ if spec.satisfies('+memchecker', strict=True):
+ config_args.extend([
+ '--enable-debug',
+ '--with-valgrind={0}'.format(spec['valgrind'].prefix),
+ ])
+
# Hwloc support
if spec.satisfies('@1.5.2:'):
config_args.append('--with-hwloc={0}'.format(spec['hwloc'].prefix))
@@ -310,7 +390,7 @@ class Openmpi(AutotoolsPackage):
config_args.extend([
'--enable-java',
'--enable-mpi-java',
- '--with-jdk-dir={0}'.format(spec['java'].prefix)
+ '--with-jdk-dir={0}'.format(spec['java'].home)
])
else:
config_args.extend([
@@ -331,7 +411,7 @@ class Openmpi(AutotoolsPackage):
config_args.append('--enable-contrib-no-build=vt')
# Multithreading support
- if spec.satisfies('@1.5.4:'):
+ if spec.satisfies('@1.5.4:2.999'):
if '+thread_multiple' in spec:
config_args.append('--enable-mpi-thread-multiple')
else:
@@ -364,45 +444,23 @@ class Openmpi(AutotoolsPackage):
else:
config_args.append('--without-cuda')
+ if '+cxx_exceptions' in spec:
+ config_args.append('--enable-cxx-exceptions')
+ else:
+ config_args.append('--disable-cxx-exceptions')
return config_args
@run_after('install')
- def filter_compilers(self):
- """Run after install to make the MPI compilers use the
- 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.
- """
- kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
- wrapper_basepath = join_path(self.prefix, 'share', 'openmpi')
-
- wrappers = [
- ('mpicc-vt-wrapper-data.txt', self.compiler.cc),
- ('mpicc-wrapper-data.txt', self.compiler.cc),
- ('ortecc-wrapper-data.txt', self.compiler.cc),
- ('shmemcc-wrapper-data.txt', self.compiler.cc),
- ('mpic++-vt-wrapper-data.txt', self.compiler.cxx),
- ('mpic++-wrapper-data.txt', self.compiler.cxx),
- ('ortec++-wrapper-data.txt', self.compiler.cxx),
- ('mpifort-vt-wrapper-data.txt', self.compiler.fc),
- ('mpifort-wrapper-data.txt', self.compiler.fc),
- ('shmemfort-wrapper-data.txt', self.compiler.fc),
- ('mpif90-vt-wrapper-data.txt', self.compiler.fc),
- ('mpif90-wrapper-data.txt', self.compiler.fc),
- ('mpif77-vt-wrapper-data.txt', self.compiler.f77),
- ('mpif77-wrapper-data.txt', self.compiler.f77)
- ]
-
- for wrapper_name, compiler in wrappers:
- wrapper = join_path(wrapper_basepath, wrapper_name)
- if not os.path.islink(wrapper):
- # Substitute Spack compile wrappers for the real
- # underlying compiler
- match = 'compiler=.*'
- substitute = 'compiler={compiler}'.format(compiler=compiler)
- filter_file(match, substitute, wrapper, **kwargs)
- # Remove this linking flag if present
- # (it turns RPATH into RUNPATH)
- filter_file('-Wl,--enable-new-dtags', '', wrapper, **kwargs)
+ def delete_mpirun_mpiexec(self):
+ # The preferred way to run an application when Slurm is the
+ # scheduler is to let Slurm manage process spawning via PMI.
+ #
+ # Deleting the links to orterun avoids users running their
+ # applications via mpirun or mpiexec, and leaves srun as the
+ # only sensible choice (orterun is still present, but normal
+ # users don't know about that).
+ if '@1.6: ~legacylaunchers schedulers=slurm' in self.spec:
+ os.remove(self.prefix.bin.mpirun)
+ os.remove(self.prefix.bin.mpiexec)
+ os.remove(self.prefix.bin.shmemrun)
+ os.remove(self.prefix.bin.oshrun)