Windows: MSMPI package fixes (#35112)

* Add "fake" mpi compiler wrappers to msmpi: msmpi doesn't actually
  provide wrappers, so this just assigns the wrappers to be whatever
  compiler that a dependent is using. Packages referencing the
  wrappers would otherwise break. This is assumed to be workable
  because build scripts will need to assemble appropriate information
  to pass to the compiler anyway
* Fix msmpi detection stanza ('executable' is not the correct name of
  the property)
* Fix compiler pkg dereference
This commit is contained in:
John W. Parent 2023-02-09 12:53:59 -05:00 committed by GitHub
parent 8c0b8c785f
commit 259a32e5e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ class Msmpi(Package):
git = "https://github.com/microsoft/Microsoft-MPI.git"
tags = ["windows"]
executable = ["mpiexec"]
executables = ["mpiexec"]
version("10.1.1", sha256="63c7da941fc4ffb05a0f97bd54a67968c71f63389a0d162d3182eabba1beab3d")
version("10.0.0", sha256="cfb53cf53c3cf0d4935ab58be13f013a0f7ccb1189109a5b8eea0fcfdcaef8c1")
@ -41,10 +41,20 @@ def determine_version(cls, exe):
ver_str = re.search(r"Microsoft MPI Startup Program \[Version ([0-9.]+)\]", output)
return Version(ver_str.group(1)) if ver_str else None
def setup_dependent_package(self, module, dependent_spec):
spec = self.spec
# MSMPI does not vendor compiler wrappers, instead arguments should
# be manually supplied to compiler by consuming package
# Note: This is not typical of MPI installations
spec.mpicc = spack_cc
spec.mpicxx = spack_cxx
spec.mpifc = spack_fc
spec.mpif77 = spack_f77
class GenericBuilder(GenericBuilder):
def setup_build_environment(self, env):
ifort_root = os.path.join(*self.compiler.fc.split(os.path.sep)[:-2])
ifort_root = os.path.join(*self.pkg.compiler.fc.split(os.path.sep)[:-2])
env.set("SPACK_IFORT", ifort_root)
def is_64bit(self):
@ -52,18 +62,18 @@ def is_64bit(self):
def build_command_line(self):
args = ["-noLogo"]
ifort_bin = self.compiler.fc
ifort_bin = self.pkg.compiler.fc
if not ifort_bin:
raise InstallError(
"Cannot install MSMPI without fortran"
"please select a compiler with fortran support."
)
args.append("/p:IFORT_BIN=%s" % os.path.dirname(ifort_bin))
args.append("/p:VCToolsVersion=%s" % self.compiler.msvc_version)
args.append("/p:WindowsTargetPlatformVersion=%s" % str(self.spec["wdk"].version))
args.append("/p:PlatformToolset=%s" % self.compiler.cc_version)
args.append("/p:VCToolsVersion=%s" % self.pkg.compiler.msvc_version)
args.append("/p:WindowsTargetPlatformVersion=%s" % str(self.pkg.spec["wdk"].version))
args.append("/p:PlatformToolset=%s" % self.pkg.compiler.cc_version)
return args
def install(self, spec, prefix):
with working_dir(self.stage.build_directory, create=True):
with working_dir(self.pkg.stage.build_directory, create=True):
msbuild(*self.build_command_line())