openmpi: only set variants when condition is met (#30585)

This commit is contained in:
Harmen Stoppels 2022-05-10 21:05:44 +02:00 committed by GitHub
parent c45ee381bd
commit 9ce726eed5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,7 +384,7 @@ class Openmpi(AutotoolsPackage, CudaPackage):
def determine_version(cls, exe): def determine_version(cls, exe):
output = Executable(exe)(output=str, error=str) output = Executable(exe)(output=str, error=str)
match = re.search(r'Open MPI: (\S+)', output) match = re.search(r'Open MPI: (\S+)', output)
return match.group(1) if match else None return Version(match.group(1)) if match else None
@classmethod @classmethod
def determine_variants(cls, exes, version): def determine_variants(cls, exes, version):
@ -398,13 +398,19 @@ def determine_variants(cls, exes, version):
# begins with --, we want to use the defaults as provided # begins with --, we want to use the defaults as provided
# by the openmpi package in the absense of any other info. # by the openmpi package in the absense of any other info.
# atomics
if re.search(r'--enable-builtin-atomics', output): if re.search(r'--enable-builtin-atomics', output):
variants.append("+atomics") variants.append("+atomics")
match = re.search(r'\bJava bindings: (\S+)', output)
if match and is_enabled(match.group(1)): # java
variants.append("+java") if version in spack.version.ver('1.7.4:'):
else: match = re.search(r'\bJava bindings: (\S+)', output)
variants.append("~java") if match and is_enabled(match.group(1)):
variants.append("+java")
else:
variants.append("~java")
# static
if re.search(r'--enable-static', output): if re.search(r'--enable-static', output):
variants.append("+static") variants.append("+static")
elif re.search(r'--disable-static', output): elif re.search(r'--disable-static', output):
@ -414,17 +420,27 @@ def determine_variants(cls, exes, version):
# Built multiple variants of openmpi and ran diff. # Built multiple variants of openmpi and ran diff.
# This seems to be the distinguishing feature. # This seems to be the distinguishing feature.
variants.append("~static") variants.append("~static")
if re.search(r'\bMCA db: sqlite', output):
variants.append("+sqlite3") # sqlite
else: if version in spack.version.ver('1.7.3:1'):
variants.append("~sqlite3") if re.search(r'\bMCA db: sqlite', output):
variants.append("+sqlite3")
else:
variants.append("~sqlite3")
# vt
if re.search(r'--enable-contrib-no-build=vt', output): if re.search(r'--enable-contrib-no-build=vt', output):
variants.append('+vt') variants.append('+vt')
match = re.search(r'MPI_THREAD_MULTIPLE: (\S+?),?', output)
if match and is_enabled(match.group(1)): # thread_multiple
variants.append('+thread_multiple') if version in spack.version.ver('1.5.4:2'):
else: match = re.search(r'MPI_THREAD_MULTIPLE: (\S+?),?', output)
variants.append('~thread_multiple') if match and is_enabled(match.group(1)):
variants.append('+thread_multiple')
else:
variants.append('~thread_multiple')
# cuda
match = re.search( match = re.search(
r'parameter "mpi_built_with_cuda_support" ' + r'parameter "mpi_built_with_cuda_support" ' +
r'\(current value: "(\S+)"', r'\(current value: "(\S+)"',
@ -433,39 +449,62 @@ def determine_variants(cls, exes, version):
variants.append('+cuda') variants.append('+cuda')
else: else:
variants.append('~cuda') variants.append('~cuda')
match = re.search(r'\bWrapper compiler rpath: (\S+)', output)
if match and is_enabled(match.group(1)): # wrapper-rpath
variants.append('+wrapper-rpath') if version in spack.version.ver('1.7.4:'):
else: match = re.search(r'\bWrapper compiler rpath: (\S+)', output)
variants.append('~wrapper-rpath') if match and is_enabled(match.group(1)):
match = re.search(r'\bC\+\+ bindings: (\S+)', output) variants.append('+wrapper-rpath')
if match and match.group(1) == 'yes': else:
variants.append('+cxx') variants.append('~wrapper-rpath')
else:
variants.append('~cxx') # cxx
match = re.search(r'\bC\+\+ exceptions: (\S+)', output) if version in spack.version.ver(':4'):
if match and match.group(1) == 'yes': match = re.search(r'\bC\+\+ bindings: (\S+)', output)
variants.append('+cxx_exceptions') if match and match.group(1) == 'yes':
else: variants.append('+cxx')
variants.append('~cxx_exceptions') else:
if re.search(r'--with-singularity', output): variants.append('~cxx')
variants.append('+singularity')
# cxx_exceptions
if version in spack.version.ver(':4'):
match = re.search(r'\bC\+\+ exceptions: (\S+)', output)
if match and match.group(1) == 'yes':
variants.append('+cxx_exceptions')
else:
variants.append('~cxx_exceptions')
# singularity
if version in spack.version.ver(':4'):
if re.search(r'--with-singularity', output):
variants.append('+singularity')
# lustre
if re.search(r'--with-lustre', output): if re.search(r'--with-lustre', output):
variants.append('+lustre') variants.append('+lustre')
# memchecker
match = re.search(r'Memory debugging support: (\S+)', output) match = re.search(r'Memory debugging support: (\S+)', output)
if match and is_enabled(match.group(1)): if match and is_enabled(match.group(1)):
variants.append('+memchecker') variants.append('+memchecker')
else: else:
variants.append('~memchecker') variants.append('~memchecker')
if re.search(r'\bMCA (?:ess|prrte): pmi', output):
variants.append('+pmi')
else:
variants.append('~pmi')
if re.search(r'\bMCA pmix', output):
variants.append('+pmix')
else:
variants.append('~pmix')
# pmi
if version in spack.version.ver('1.5.5:4'):
if re.search(r'\bMCA (?:ess|prrte): pmi', output):
variants.append('+pmi')
else:
variants.append('~pmi')
# pmix
if version in spack.version.ver('2:4'):
if re.search(r'\bMCA pmix', output):
variants.append('+pmix')
else:
variants.append('~pmix')
# fabrics
fabrics = get_options_from_variant(cls, "fabrics") fabrics = get_options_from_variant(cls, "fabrics")
used_fabrics = [] used_fabrics = []
for fabric in fabrics: for fabric in fabrics:
@ -476,6 +515,7 @@ def determine_variants(cls, exes, version):
if used_fabrics: if used_fabrics:
variants.append('fabrics=' + ','.join(used_fabrics)) variants.append('fabrics=' + ','.join(used_fabrics))
# schedulers
schedulers = get_options_from_variant(cls, "schedulers") schedulers = get_options_from_variant(cls, "schedulers")
used_schedulers = [] used_schedulers = []
for scheduler in schedulers: for scheduler in schedulers: