Bugfix: Support old installations using Cray MPICH (#20663)

#20076 moved Cray-specific MPICH support from the Spack MPICH package
to a new cray-mpich Package. This broke existing package installs
using external mpich on Cray systems. This PR keeps the cray-mpich
package but restores the Cray-specific MPICH support for older
installations.

In the future this support should be removed from the Spack mpich
package and users should be directed to use cray-mpich on Cray.
This commit is contained in:
Peter Scheibel 2021-01-04 17:19:08 -08:00 committed by GitHub
parent f4acf74091
commit 22a45e010a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -301,10 +301,23 @@ def setup_build_environment(self, env):
def setup_run_environment(self, env): def setup_run_environment(self, env):
# Because MPI implementations provide compilers, they have to add to # Because MPI implementations provide compilers, they have to add to
# their run environments the code to make the compilers available. # their run environments the code to make the compilers available.
env.set('MPICC', join_path(self.prefix.bin, 'mpicc')) # For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
env.set('MPICXX', join_path(self.prefix.bin, 'mpic++')) # Cray MPIs always have cray in the module name, e.g. "cray-mpich"
env.set('MPIF77', join_path(self.prefix.bin, 'mpif77')) external_modules = self.spec.external_modules
env.set('MPIF90', join_path(self.prefix.bin, 'mpif90')) if external_modules and 'cray' in external_modules[0]:
# This is intended to support external MPICH instances registered
# by Spack on Cray machines prior to a879c87; users defining an
# external MPICH entry for Cray should generally refer to the
# "cray-mpich" package
env.set('MPICC', spack_cc)
env.set('MPICXX', spack_cxx)
env.set('MPIF77', spack_fc)
env.set('MPIF90', spack_fc)
else:
env.set('MPICC', join_path(self.prefix.bin, 'mpicc'))
env.set('MPICXX', join_path(self.prefix.bin, 'mpic++'))
env.set('MPIF77', join_path(self.prefix.bin, 'mpif77'))
env.set('MPIF90', join_path(self.prefix.bin, 'mpif90'))
def setup_dependent_build_environment(self, env, dependent_spec): def setup_dependent_build_environment(self, env, dependent_spec):
self.setup_run_environment(env) self.setup_run_environment(env)
@ -318,12 +331,21 @@ def setup_dependent_build_environment(self, env, dependent_spec):
def setup_dependent_package(self, module, dependent_spec): def setup_dependent_package(self, module, dependent_spec):
spec = self.spec spec = self.spec
spec.mpicc = join_path(self.prefix.bin, 'mpicc') # For Cray MPIs, the regular compiler wrappers *are* the MPI wrappers.
spec.mpicxx = join_path(self.prefix.bin, 'mpic++') # Cray MPIs always have cray in the module name, e.g. "cray-mpich"
external_modules = spec.external_modules
if external_modules and 'cray' in external_modules[0]:
spec.mpicc = spack_cc
spec.mpicxx = spack_cxx
spec.mpifc = spack_fc
spec.mpif77 = spack_f77
else:
spec.mpicc = join_path(self.prefix.bin, 'mpicc')
spec.mpicxx = join_path(self.prefix.bin, 'mpic++')
if '+fortran' in spec: if '+fortran' in spec:
spec.mpifc = join_path(self.prefix.bin, 'mpif90') spec.mpifc = join_path(self.prefix.bin, 'mpif90')
spec.mpif77 = join_path(self.prefix.bin, 'mpif77') spec.mpif77 = join_path(self.prefix.bin, 'mpif77')
spec.mpicxx_shared_libs = [ spec.mpicxx_shared_libs = [
join_path(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)), join_path(self.prefix.lib, 'libmpicxx.{0}'.format(dso_suffix)),