Fix OpenMPI external detection logic (#29946)

MPICH and OpenMPI share the same logic for these and these fixes have already been applied to MPICH.

See: https://github.com/spack/spack/pull/29284
This commit is contained in:
Kyle Gerheiser 2022-04-07 17:45:00 -04:00 committed by GitHub
parent dd6f4e680a
commit 2474609395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,7 +373,7 @@ def determine_version(cls, exe):
def determine_variants(cls, exes, version): def determine_variants(cls, exes, version):
results = [] results = []
for exe in exes: for exe in exes:
variants = '' variants = []
output = Executable(exe)("-a", output=str, error=str) output = Executable(exe)("-a", output=str, error=str)
# Some of these options we have to find by hoping the # Some of these options we have to find by hoping the
# configure string is in the ompi_info output. While this # configure string is in the ompi_info output. While this
@ -382,72 +382,72 @@ def determine_variants(cls, exes, version):
# by the openmpi package in the absense of any other info. # by the openmpi package in the absense of any other info.
if re.search(r'--enable-builtin-atomics', output): if re.search(r'--enable-builtin-atomics', output):
variants += "+atomics" variants.append("+atomics")
match = re.search(r'\bJava bindings: (\S+)', output) match = re.search(r'\bJava bindings: (\S+)', output)
if match and is_enabled(match.group(1)): if match and is_enabled(match.group(1)):
variants += "+java" variants.append("+java")
else: else:
variants += "~java" variants.append("~java")
if re.search(r'--enable-static', output): if re.search(r'--enable-static', output):
variants += "+static" variants.append("+static")
elif re.search(r'--disable-static', output): elif re.search(r'--disable-static', output):
variants += "~static" variants.append("~static")
elif re.search(r'\bMCA (?:coll|oca|pml): monitoring', elif re.search(r'\bMCA (?:coll|oca|pml): monitoring',
output): output):
# 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 += "~static" variants.append("~static")
if re.search(r'\bMCA db: sqlite', output): if re.search(r'\bMCA db: sqlite', output):
variants += "+sqlite3" variants.append("+sqlite3")
else: else:
variants += "~sqlite3" variants.append("~sqlite3")
if re.search(r'--enable-contrib-no-build=vt', output): if re.search(r'--enable-contrib-no-build=vt', output):
variants += '+vt' variants.append('+vt')
match = re.search(r'MPI_THREAD_MULTIPLE: (\S+?),?', output) match = re.search(r'MPI_THREAD_MULTIPLE: (\S+?),?', output)
if match and is_enabled(match.group(1)): if match and is_enabled(match.group(1)):
variants += '+thread_multiple' variants.append('+thread_multiple')
else: else:
variants += '~thread_multiple' variants.append('~thread_multiple')
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+)"',
output) output)
if match and is_enabled(match.group(1)): if match and is_enabled(match.group(1)):
variants += '+cuda' variants.append('+cuda')
else: else:
variants += '~cuda' variants.append('~cuda')
match = re.search(r'\bWrapper compiler rpath: (\S+)', output) match = re.search(r'\bWrapper compiler rpath: (\S+)', output)
if match and is_enabled(match.group(1)): if match and is_enabled(match.group(1)):
variants += '+wrapper-rpath' variants.append('+wrapper-rpath')
else: else:
variants += '~wrapper-rpath' variants.append('~wrapper-rpath')
match = re.search(r'\bC\+\+ bindings: (\S+)', output) match = re.search(r'\bC\+\+ bindings: (\S+)', output)
if match and match.group(1) == 'yes': if match and match.group(1) == 'yes':
variants += '+cxx' variants.append('+cxx')
else: else:
variants += '~cxx' variants.append('~cxx')
match = re.search(r'\bC\+\+ exceptions: (\S+)', output) match = re.search(r'\bC\+\+ exceptions: (\S+)', output)
if match and match.group(1) == 'yes': if match and match.group(1) == 'yes':
variants += '+cxx_exceptions' variants.append('+cxx_exceptions')
else: else:
variants += '~cxx_exceptions' variants.append('~cxx_exceptions')
if re.search(r'--with-singularity', output): if re.search(r'--with-singularity', output):
variants += '+singularity' variants.append('+singularity')
if re.search(r'--with-lustre', output): if re.search(r'--with-lustre', output):
variants += '+lustre' variants.append('+lustre')
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 += '+memchecker' variants.append('+memchecker')
else: else:
variants += '~memchecker' variants.append('~memchecker')
if re.search(r'\bMCA (?:ess|prrte): pmi', output): if re.search(r'\bMCA (?:ess|prrte): pmi', output):
variants += '+pmi' variants.append('+pmi')
else: else:
variants += '~pmi' variants.append('~pmi')
if re.search(r'\bMCA pmix', output): if re.search(r'\bMCA pmix', output):
variants += '+pmix' variants.append('+pmix')
else: else:
variants += '~pmix' variants.append('~pmix')
fabrics = get_options_from_variant(cls, "fabrics") fabrics = get_options_from_variant(cls, "fabrics")
used_fabrics = [] used_fabrics = []
@ -457,7 +457,7 @@ def determine_variants(cls, exes, version):
if match: if match:
used_fabrics.append(fabric) used_fabrics.append(fabric)
if used_fabrics: if used_fabrics:
variants += ' fabrics=' + ','.join(used_fabrics) + ' ' variants.append('fabrics=' + ','.join(used_fabrics))
schedulers = get_options_from_variant(cls, "schedulers") schedulers = get_options_from_variant(cls, "schedulers")
used_schedulers = [] used_schedulers = []
@ -467,7 +467,7 @@ def determine_variants(cls, exes, version):
if match: if match:
used_schedulers.append(scheduler) used_schedulers.append(scheduler)
if used_schedulers: if used_schedulers:
variants += ' schedulers=' + ','.join(used_schedulers) + ' ' variants.append('schedulers=' + ','.join(used_schedulers))
# Get the appropriate compiler # Get the appropriate compiler
match = re.search(r'\bC compiler absolute: (\S+)', output) match = re.search(r'\bC compiler absolute: (\S+)', output)
@ -475,8 +475,8 @@ def determine_variants(cls, exes, version):
compiler_spec = get_spack_compiler_spec( compiler_spec = get_spack_compiler_spec(
os.path.dirname(match.group(1))) os.path.dirname(match.group(1)))
if compiler_spec: if compiler_spec:
variants += "%" + str(compiler_spec) variants.append("%" + str(compiler_spec))
results.append(variants) results.append(' '.join(variants))
return results return results
def url_for_version(self, version): def url_for_version(self, version):
@ -1048,7 +1048,8 @@ def get_spack_compiler_spec(path):
actual_compiler = None actual_compiler = None
# check if the compiler actually matches the one we want # check if the compiler actually matches the one we want
for spack_compiler in spack_compilers: for spack_compiler in spack_compilers:
if os.path.dirname(spack_compiler.cc) == path: if (spack_compiler.cc and
os.path.dirname(spack_compiler.cc) == path):
actual_compiler = spack_compiler actual_compiler = spack_compiler
break break
return actual_compiler.spec if actual_compiler else None return actual_compiler.spec if actual_compiler else None