summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRobert Blake <blake14@llnl.gov>2020-08-24 18:53:42 -0700
committerGitHub <noreply@github.com>2020-08-24 20:53:42 -0500
commit5e1909c00a687684cb51516d124d43eedcc8f1d3 (patch)
treea6ac203b4bff0cbdffc15c9b4b0fb3a613452d70 /var
parentb885dbcd8513f9d218dd5f135e189119c1748d2b (diff)
downloadspack-5e1909c00a687684cb51516d124d43eedcc8f1d3.tar.gz
spack-5e1909c00a687684cb51516d124d43eedcc8f1d3.tar.bz2
spack-5e1909c00a687684cb51516d124d43eedcc8f1d3.tar.xz
spack-5e1909c00a687684cb51516d124d43eedcc8f1d3.zip
mvapich2: Adding external find support. (#18177)
* Adding external support for mvapich2. This picks up all the options that are currently settable by the spack package. It also detects the compiler and sets it appropriately. * Removing debugging printing. * Adding changes suggested by @nithintsk
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/mvapich2/package.py104
1 files changed, 104 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py
index 0f25cb7111..3031082ee7 100644
--- a/var/spack/repos/builtin/packages/mvapich2/package.py
+++ b/var/spack/repos/builtin/packages/mvapich2/package.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import re
import os.path
import sys
@@ -18,6 +19,8 @@ class Mvapich2(AutotoolsPackage):
maintainers = ['nithintsk', 'harisubramoni']
+ executables = ['^mpiname$']
+
# Prefer the latest stable release
version('2.3.4', sha256='7226a45c7c98333c8e5d2888119cce186199b430c13b7b1dca1769909e68ea7a')
version('2.3.3', sha256='41d3261be57e5bc8aabf4e32981543c015c5443ff032a26f18205985e18c2b73')
@@ -122,6 +125,107 @@ class Mvapich2(AutotoolsPackage):
'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin'
)
+ @classmethod
+ def determine_version(cls, exe):
+ output = Executable(exe)('-a', output=str, error=str)
+ match = re.search(r'^MVAPICH2 (\S+)', output)
+ return match.group(1) if match else None
+
+ @classmethod
+ def determine_variants(cls, exes, version):
+ def get_spack_compiler_spec(path):
+ spack_compilers = spack.compilers.find_compilers([path])
+ for spack_compiler in spack_compilers:
+ if os.path.dirname(spack_compiler.cc) == path:
+ return spack_compiler.spec
+ return None
+ results = []
+ for exe in exes:
+ variants = ''
+ output = Executable(exe)('-a', output=str, error=str)
+
+ if re.search(r'--enable-wrapper-rpath=yes', output):
+ variants += '+wrapperrpath'
+ else:
+ variants += '~wrapperrpath'
+
+ if (re.search(r'--disable-fast', output)
+ and re.search(r'--enable-error-checking=runtime', output)
+ and re.search(r'--enable-error-messages', output)
+ and re.search(r'--enable-g', output)
+ and re.search(r'--enable-debuginfo', output)):
+ variants += '+debug'
+ else:
+ variants += '~debug'
+
+ if re.search('--enable-cuda', output):
+ variants += '+cuda'
+ else:
+ variants += '~cuda'
+
+ if re.search('--enable-registration-cache', output):
+ variants += '+regcache'
+ else:
+ variants += '~regcache'
+
+ match = re.search(r'--enable-threads=(\S+)', output)
+ if match:
+ variants += " threads=" + match.group(1)
+
+ match = re.search(r'--with-ch3-rank-bits=(\S+)', output)
+ if match:
+ variants += " ch3_rank_bits=" + match.group(1)
+
+ pms = []
+ if re.search(r'--with-pm=slurm', output):
+ pms.append('slurm')
+ if re.search(r'--with-pm=[A-Za-z0-9:]*hydra', output):
+ pms.append('hydra')
+ if re.search(r'--with-pm=[A-Za-z0-9:]*gforker', output):
+ pms.append('gforker')
+ if re.search(r'--with-pm=[A-Za-z0-9:]*remshell', output):
+ pms.append('remshell')
+ if pms:
+ variants += " process_managers=" + ",".join(pms)
+
+ fabrics = {
+ 'sock': 'ch3:sock',
+ 'nemesistcpib': 'ch3:nemesis:tcp,ib',
+ 'nemesisibtcp': 'ch3:nemesis:ib,tcp',
+ 'nemesisib': 'ch3:nemesis:ib',
+ 'nemesis': 'ch3:nemesis',
+ 'mrail': 'ch3:mrail',
+ 'nemesisofi': 'ch3:nemesis:ofi',
+ }
+ for fabric_name, conf_flag in fabrics.items():
+ if re.search(r'--with-device=' + conf_flag, output):
+ variants += ' fabrics=' + fabric_name
+ break
+ else:
+ if re.search(r'--with-device=psm', output):
+ if re.search(r'--with-psm=', output):
+ variants += ' fabrics=psm'
+ elif re.search(r'--with-psm2=', output):
+ variants += ' fabrics=psm2'
+
+ used_fs = []
+ for fs in ('lustre', 'gpfs', 'nfs', 'ufs'):
+ if re.search(
+ '--with-file-system=[a-zA-Z0-9+]*' + fs,
+ output):
+ used_fs.append(fs)
+ if used_fs:
+ variants += ' file_systems=' + ",".join(used_fs)
+
+ match = re.search(r'CC: (\S+)', output)
+ if match:
+ comp_spec = get_spack_compiler_spec(
+ os.path.dirname(match.group(1)))
+ if comp_spec:
+ variants += " %" + str(comp_spec)
+ results.append(variants)
+ return results
+
@property
def libs(self):
query_parameters = self.spec.last_query.extra_parameters