Skip to content
Snippets Groups Projects
Commit 3d2b25e4 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

Merge pull request #1014 from epfl-scitas/packages/mvapich2

Changes to take into account slurm in version @2.1: of mvapich2
parents 27bc49d8 3ab8468e
Branches
Tags
No related merge requests found
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
from spack import * from spack import *
import os import os
class Mvapich2(Package): class Mvapich2(Package):
"""MVAPICH2 is an MPI implementation for Infiniband networks.""" """MVAPICH2 is an MPI implementation for Infiniband networks."""
homepage = "http://mvapich.cse.ohio-state.edu/" homepage = "http://mvapich.cse.ohio-state.edu/"
...@@ -43,8 +44,9 @@ class Mvapich2(Package): ...@@ -43,8 +44,9 @@ class Mvapich2(Package):
variant('debug', default=False, description='Enables debug information and error messages at run-time') variant('debug', default=False, description='Enables debug information and error messages at run-time')
########## ##########
# TODO : Process managers should be grouped into the same variant, as soon as variant capabilities will be extended # TODO : Process managers should be grouped into the same variant,
# See https://groups.google.com/forum/#!topic/spack/F8-f8B4_0so # as soon as variant capabilities will be extended See
# https://groups.google.com/forum/#!topic/spack/F8-f8B4_0so
SLURM = 'slurm' SLURM = 'slurm'
HYDRA = 'hydra' HYDRA = 'hydra'
GFORKER = 'gforker' GFORKER = 'gforker'
...@@ -57,7 +59,8 @@ class Mvapich2(Package): ...@@ -57,7 +59,8 @@ class Mvapich2(Package):
########## ##########
########## ##########
# TODO : Network types should be grouped into the same variant, as soon as variant capabilities will be extended # TODO : Network types should be grouped into the same variant, as
# soon as variant capabilities will be extended
PSM = 'psm' PSM = 'psm'
SOCK = 'sock' SOCK = 'sock'
NEMESISIBTCP = 'nemesisibtcp' NEMESISIBTCP = 'nemesisibtcp'
...@@ -84,8 +87,8 @@ def url_for_version(self, version): ...@@ -84,8 +87,8 @@ def url_for_version(self, version):
@staticmethod @staticmethod
def enabled(x): def enabled(x):
""" """Given a variant name returns the string that means the variant is
Given a variant name returns the string that means the variant is enabled enabled
:param x: variant name :param x: variant name
:return: :return:
...@@ -93,8 +96,8 @@ def enabled(x): ...@@ -93,8 +96,8 @@ def enabled(x):
return '+' + x return '+' + x
def set_build_type(self, spec, configure_args): def set_build_type(self, spec, configure_args):
""" """Appends to configure_args the flags that depends only on the build
Appends to configure_args the flags that depends only on the build type (i.e. release or debug) type (i.e. release or debug)
:param spec: spec :param spec: spec
:param configure_args: list of current configure arguments :param configure_args: list of current configure arguments
...@@ -104,7 +107,8 @@ def set_build_type(self, spec, configure_args): ...@@ -104,7 +107,8 @@ def set_build_type(self, spec, configure_args):
"--disable-fast", "--disable-fast",
"--enable-error-checking=runtime", "--enable-error-checking=runtime",
"--enable-error-messages=all", "--enable-error-messages=all",
"--enable-g=dbg", "--enable-debuginfo" # Permits debugging with TotalView # Permits debugging with TotalView
"--enable-g=dbg", "--enable-debuginfo"
] ]
else: else:
build_type_options = ["--enable-fast=all"] build_type_options = ["--enable-fast=all"]
...@@ -112,25 +116,41 @@ def set_build_type(self, spec, configure_args): ...@@ -112,25 +116,41 @@ def set_build_type(self, spec, configure_args):
configure_args.extend(build_type_options) configure_args.extend(build_type_options)
def set_process_manager(self, spec, configure_args): def set_process_manager(self, spec, configure_args):
""" """Appends to configure_args the flags that will enable the
Appends to configure_args the flags that will enable the appropriate process managers appropriate process managers
:param spec: spec :param spec: spec
:param configure_args: list of current configure arguments :param configure_args: list of current configure arguments
""" """
# Check that slurm variant is not activated together with other pm variants # Check that slurm variant is not activated together with
has_slurm_incompatible_variants = any(self.enabled(x) in spec for x in Mvapich2.SLURM_INCOMPATIBLE_PMS) # other pm variants
if self.enabled(Mvapich2.SLURM) in spec and has_slurm_incompatible_variants: has_slurm_incompatible_variants = \
raise RuntimeError(" %s : 'slurm' cannot be activated together with other process managers" % self.name) any(self.enabled(x) in spec
for x in Mvapich2.SLURM_INCOMPATIBLE_PMS)
if self.enabled(Mvapich2.SLURM) in spec and \
has_slurm_incompatible_variants:
raise RuntimeError(" %s : 'slurm' cannot be activated \
together with other process managers" % self.name)
process_manager_options = [] process_manager_options = []
# See: http://slurm.schedmd.com/mpi_guide.html#mvapich2
if self.enabled(Mvapich2.SLURM) in spec: if self.enabled(Mvapich2.SLURM) in spec:
process_manager_options = [ if self.version > Version('2.0'):
"--with-pm=slurm" process_manager_options = [
] "--with-pmi=pmi2",
"--with-pm=slurm"
]
else:
process_manager_options = [
"--with-pmi=slurm",
"--with-pm=no"
]
elif has_slurm_incompatible_variants: elif has_slurm_incompatible_variants:
pms = [] pms = []
# The variant name is equal to the process manager name in the configuration options # The variant name is equal to the process manager name in
# the configuration options
for x in Mvapich2.SLURM_INCOMPATIBLE_PMS: for x in Mvapich2.SLURM_INCOMPATIBLE_PMS:
if self.enabled(x) in spec: if self.enabled(x) in spec:
pms.append(x) pms.append(x)
...@@ -146,7 +166,9 @@ def set_network_type(self, spec, configure_args): ...@@ -146,7 +166,9 @@ def set_network_type(self, spec, configure_args):
if self.enabled(x) in spec: if self.enabled(x) in spec:
count += 1 count += 1
if count > 1: if count > 1:
raise RuntimeError('network variants are mutually exclusive (only one can be selected at a time)') raise RuntimeError('network variants are mutually exclusive \
(only one can be selected at a time)')
network_options = [] network_options = []
# From here on I can suppose that only one variant has been selected # From here on I can suppose that only one variant has been selected
if self.enabled(Mvapich2.PSM) in spec: if self.enabled(Mvapich2.PSM) in spec:
...@@ -164,6 +186,11 @@ def set_network_type(self, spec, configure_args): ...@@ -164,6 +186,11 @@ def set_network_type(self, spec, configure_args):
configure_args.extend(network_options) configure_args.extend(network_options)
def setup_environment(self, spack_env, run_env):
if self.enabled(Mvapich2.SLURM) in self.spec and \
self.version > Version('2.0'):
run_env.set('SLURM_MPI_TYPE', 'pmi2')
def setup_dependent_environment(self, spack_env, run_env, extension_spec): def setup_dependent_environment(self, spack_env, run_env, extension_spec):
spack_env.set('MPICH_CC', spack_cc) spack_env.set('MPICH_CC', spack_cc)
spack_env.set('MPICH_CXX', spack_cxx) spack_env.set('MPICH_CXX', spack_cxx)
...@@ -178,7 +205,8 @@ def setup_dependent_package(self, module, dep_spec): ...@@ -178,7 +205,8 @@ def setup_dependent_package(self, module, dep_spec):
self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77') self.spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
def install(self, spec, prefix): def install(self, spec, prefix):
# we'll set different configure flags depending on our environment # we'll set different configure flags depending on our
# environment
configure_args = [ configure_args = [
"--prefix=%s" % prefix, "--prefix=%s" % prefix,
"--enable-shared", "--enable-shared",
...@@ -208,7 +236,6 @@ def install(self, spec, prefix): ...@@ -208,7 +236,6 @@ def install(self, spec, prefix):
self.filter_compilers() self.filter_compilers()
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.
...@@ -228,8 +255,17 @@ def filter_compilers(self): ...@@ -228,8 +255,17 @@ def filter_compilers(self):
spack_f77 = os.environ['F77'] spack_f77 = os.environ['F77']
spack_fc = os.environ['FC'] spack_fc = os.environ['FC']
kwargs = { 'ignore_absent' : True, 'backup' : False, 'string' : True } kwargs = {
filter_file('CC="%s"' % spack_cc , 'CC="%s"' % self.compiler.cc, mpicc, **kwargs) 'ignore_absent': True,
filter_file('CXX="%s"'% spack_cxx, 'CXX="%s"' % self.compiler.cxx, mpicxx, **kwargs) 'backup': False,
filter_file('F77="%s"'% spack_f77, 'F77="%s"' % self.compiler.f77, mpif77, **kwargs) 'string': True
filter_file('FC="%s"' % spack_fc , 'FC="%s"' % self.compiler.fc, mpif90, **kwargs) }
filter_file('CC="%s"' % spack_cc,
'CC="%s"' % self.compiler.cc, mpicc, **kwargs)
filter_file('CXX="%s"' % spack_cxx,
'CXX="%s"' % self.compiler.cxx, mpicxx, **kwargs)
filter_file('F77="%s"' % spack_f77,
'F77="%s"' % self.compiler.f77, mpif77, **kwargs)
filter_file('FC="%s"' % spack_fc,
'FC="%s"' % self.compiler.fc, mpif90, **kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment